Class Graphics2DTestPlusUserDrawing
java.lang.Object
Graphics2DTest
Graphics2DTestPlusUserDrawing
- Direct Known Subclasses:
- Graphics2DTestPlusGlassPane
- public class Graphics2DTestPlusUserDrawing
- extends Graphics2DTest
This is an extension of the Graphics2DTest example that illustrates how to
let the user draw rectangles on the canvas by dragging the mouse. As the
user drags the mouse, the rectangle dynamically tracks the mouse movements.
The inner class RectDrawingListener is the interesting part.
Field Summary |
protected static int |
startX
The starting x-axis position for the drawn rectangle |
protected static int |
startY
The starting y-axis position for the drawn rectangle |
Method Summary |
static void |
changeDeleteButtonListener()
Change the action listener for the `Delete Rect' button so it does not
decrement the x,y positions for the fixed rects if the rect being
deleted is one that was drawn by the user. |
static void |
main(java.lang.String[] args)
Call the parent compose method and the local button listener change
method. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
startX
protected static int startX
- The starting x-axis position for the drawn rectangle
startY
protected static int startY
- The starting y-axis position for the drawn rectangle
Graphics2DTestPlusUserDrawing
public Graphics2DTestPlusUserDrawing()
changeDeleteButtonListener
public static void changeDeleteButtonListener()
- Change the action listener for the `Delete Rect' button so it does not
decrement the x,y positions for the fixed rects if the rect being
deleted is one that was drawn by the user.
main
public static void main(java.lang.String[] args)
- Call the parent compose method and the local button listener change
method. Then add a new RectDrawingListener to the canvas.