How to draw rectangle using JAVA
Posted on 2009-04-28
I want to draw rectangle in java.
This rectangle should be defined by the end points of one of the diagonals.
I need to draw rectangle like this:
If I click "Draw Rectangle" button and click first point on the screen, the rectangle formed by clicked point and the current mouse location is then displayed in red until the second mouse click. After that the rectangle is displayed in the standard color.
Could you please tell me how to draw the rectangle using above information in java?
Once I click first mouse click, rectangle formed by mouse click and moving rectangle with mouse until click the second mouse click then the rectangle formed completely.