Programming Examples

Are you a Programmer or Application Developer or a DBA? Take a cup of coffee, sit back and spend few minutes here :)

Tag Archive for ‘MouseListener’

Line Drawing : AWT Drawing – Part 2

Java AWT Line Drawing Sequence

A line requires two points. The JAVA AWT Graphics API also require two points to perform Line Drawing. In our Example, we will use left mouse press to record the first point and left mouse release to record the second point. Then, the Graphics API uses these two points to draw the line. This means, after pressing the mouse button, the user will drag the mouse to the location where they want the second point. Once the second point location is reached, the user will release the mouse button. The below picture explains the sequence of operation on the mouse to draw a line:

Continue Reading →