- Mar 31, 2003
- 11,679
- 0
- 81
I am trying to draw any number of shapes on a JPanel in java.
Right now I have my onMouseClick event logging the starting point for the shape. I have my on mouse drag logging points as it drags and repainting as that changes.
The thing is, in Java, the first point is the top left point of the shape. I can't figure out how to draw the shape starting at any other corner.
For instance, if I draw my fillRect at starting point (40, 40), and then drag the mouse to (20, 20) how do I get the rectangle to show up in that space and NOT from 40, 40 to 60, 60?
I am working on this in a college project, so do not write the code. If you could point me in the right direction; however, that would be much appreciated. I've been stuck on this part for a good 2 hours
Thanks,
-Kevin
Right now I have my onMouseClick event logging the starting point for the shape. I have my on mouse drag logging points as it drags and repainting as that changes.
The thing is, in Java, the first point is the top left point of the shape. I can't figure out how to draw the shape starting at any other corner.
For instance, if I draw my fillRect at starting point (40, 40), and then drag the mouse to (20, 20) how do I get the rectangle to show up in that space and NOT from 40, 40 to 60, 60?
I am working on this in a college project, so do not write the code. If you could point me in the right direction; however, that would be much appreciated. I've been stuck on this part for a good 2 hours
Thanks,
-Kevin
