can somebody tell me what this code actually does?

int i = 0;
		while (i < -1) {
			double x = xCoordinates[i];
			double y = yCoordinates[i];

			long xx = getWidth() - Math.round((double) getWidth() * x / 1024.0);
			long yy = getHeight()- Math.round((double) getHeight() * y / 768.0);
			g2.translate(xx, yy);

			g2.setTransform(new AffineTransform());



		g.drawImage(mImage, 0, 0, null);

i am mostly intrested in lines 6,7,8 and 13

Lines 2,3,4 also suspect, the array references will only be executed if the array index is negative and therefore out of bounds.

6,7 seem to take xy coords in the range 1024,768 and scale them to fit the actual size of the current component. They also invert them so the origin is the bottom right corner (seems normal for y, unusual for x - I would expect bottom LH corner)

sorry for such a late reply, thanks a lot for this explanation it does make the code clearer thank you

hey guys again, well what this program actually does is sets points in the different loacations of the image and what i need to do is draw a line between those points but i have no idea how to do it because im unable to grab the coordinates of the second point and draw the line between the first one and the second one.
any suggestions?

I think this is anew topic and deserves its own thread, but... there's no way to answer this without a lit more info about where the points come from - a file? user mouse clicks?
Suggest you start a new thread and describe the situation in much more detail.

This question has already been answered. Start a new discussion instead.