atramposch 3 Light Poster

Imagine a windows paint program that draws a square.

I wrote some code to do the following:

A vertex change may make a square bigger or smaller (or unchanged if the vertex value is the same). You must adjust the other vertices, as necessary, to keep the shape a square. Use the vertex that is being set to determine how much each of the other vertices must move in an x and y-direction to maintain a square shape. Note that changing a vertex may result in the position of the square moving as a side affect - this is expected! Ask me if you don't understand how to approach this problem!

given that you have 4 points for a square (Point type which have int coords)

public void setVertex(int index, Point vertex)

i wrote this method, and came up with my own idea but was wondering if anyone can see a simple way to do this.

So here is a challenge if you are bored.