public class MouseDragBox extends MouseInputAdapter
Constructor and Description |
---|
MouseDragBox(JComponent component)
Creates a new instance to work with the given component.
|
Modifier and Type | Method and Description |
---|---|
void |
mouseDragged(MouseEvent ev)
If the box is enabled, draws the box with the diagonal running from the start position to the
current mouse position.
|
void |
mousePressed(MouseEvent ev)
If the box is enabled, records the start position for subsequent drawing as the mouse is
dragged.
|
void |
mouseReleased(MouseEvent ev)
If the box is enabled, removes the final box.
|
void |
setEnabled(boolean state)
Enables or disables the drag box.
|
mouseClicked, mouseEntered, mouseExited, mouseMoved, mouseWheelMoved
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
mouseClicked, mouseEntered, mouseExited
mouseMoved
public MouseDragBox(JComponent component)
component
- the component on which the box will be drawnpublic void setEnabled(boolean state)
state
- true
to enable; false
to disablepublic void mousePressed(MouseEvent ev)
mousePressed
in interface MouseListener
mousePressed
in class MouseAdapter
ev
- input mouse eventpublic void mouseDragged(MouseEvent ev)
mouseDragged
in interface MouseMotionListener
mouseDragged
in class MouseAdapter
ev
- input mouse eventpublic void mouseReleased(MouseEvent ev)
mouseReleased
in interface MouseListener
mouseReleased
in class MouseAdapter
ev
- the input mouse eventCopyright © 1996–2019 Geotools. All rights reserved.