public interface IBehavior
When a programmer needs to add a way to permit user to interact with the current object where the graphical
information is stored and represented, (see MapControl
), must analyze and decide the basic
behavior nature of the interaction.
That behavior will manage mouse events and generate information and tool events that the
associated ToolListener
will use to interact with the MapControl
object ultimately.
It will be possible also combine more than one behavior for a tool listener, for having a richness tool.
Modifier and Type | Method and Description |
---|---|
Image |
getImageCursor()
Gets the mouse cursor of the tool listener associated to this behavior.
|
ToolListener |
getListener()
Gets the
ToolListener used by this behavior to perform actions on the
associated MapControl object. |
MapControl |
getMapControl()
Returns the reference to the
MapControl object that this behavior uses. |
void |
mouseClicked(MouseEvent e) |
void |
mouseDragged(MouseEvent e) |
void |
mouseEntered(MouseEvent e) |
void |
mouseExited(MouseEvent e) |
void |
mouseMoved(MouseEvent e) |
void |
mousePressed(MouseEvent e) |
void |
mouseReleased(MouseEvent e) |
void |
mouseWheelMoved(MouseWheelEvent e) |
void |
paintComponent(MapControlDrawer renderer)
Method executed in real-time, when user is working with a tool on the associated
MapControl
object, repainting the MapControl 's image. |
void |
setMapControl(MapControl mc)
Associates this behavior to a
MapControl object. |
ToolListener getListener()
Gets the ToolListener
used by this behavior to perform actions on the
associated MapControl
object.
ToolListener
used by this behaviorvoid paintComponent(MapControlDrawer renderer)
Method executed in real-time, when user is working with a tool on the associated MapControl
object, repainting the MapControl
's image.
Returns immediately in all cases, even if the complete image has not yet been loaded.
This method will be implemented according to the specific nature of each behavior, and its extra and particular features.
void setMapControl(MapControl mc)
Associates this behavior to a MapControl
object.
mc
- the MapControl
object to associategetMapControl()
Image getImageCursor()
Gets the mouse cursor of the tool listener associated to this behavior.
MapControl getMapControl()
Returns the reference to the MapControl
object that this behavior uses.
MapControl
object used this behaviorsetMapControl(MapControl)
void mouseClicked(MouseEvent e) throws BehaviorException
BehaviorException
- any exception processing the action associated to a mouse clicked event, by the IBehavior
objectMouseListener.mouseClicked(java.awt.event.MouseEvent)
void mouseEntered(MouseEvent e) throws BehaviorException
BehaviorException
- any exception processing the action associated to a mouse entered event, by the IBehavior
objectMouseListener.mouseEntered(java.awt.event.MouseEvent)
void mouseExited(MouseEvent e) throws BehaviorException
BehaviorException
- any exception processing the action associated to a mouse exited event, by the IBehavior
objectMouseListener.mouseExited(java.awt.event.MouseEvent)
void mousePressed(MouseEvent e) throws BehaviorException
BehaviorException
- any exception processing the action associated to a mouse pressed event, by the IBehavior
objectMouseListener.mousePressed(java.awt.event.MouseEvent)
void mouseReleased(MouseEvent e) throws BehaviorException
BehaviorException
- any exception processing the action associated to a mouse released event, by the IBehavior
objectMouseListener.mouseReleased(java.awt.event.MouseEvent)
void mouseDragged(MouseEvent e) throws BehaviorException
BehaviorException
- any exception processing the action associated to a mouse dragged event, by the IBehavior
objectMouseMotionListener.mouseDragged(java.awt.event.MouseEvent)
void mouseMoved(MouseEvent e) throws BehaviorException
BehaviorException
- any exception processing the action associated to a mouse moved event, by the IBehavior
objectMouseMotionListener.mouseMoved(java.awt.event.MouseEvent)
void mouseWheelMoved(MouseWheelEvent e) throws BehaviorException
BehaviorException
- any exception processing the action associated to a mouse wheel event, by the IBehavior
objectMouseWheelListener.mouseWheelMoved(java.awt.event.MouseWheelEvent)