Package com.bc.ceres.swing.figure
Class AbstractInteractor
- java.lang.Object
-
- com.bc.ceres.swing.figure.AbstractInteractor
-
- All Implemented Interfaces:
Interactor
,KeyListener
,MouseListener
,MouseMotionListener
,EventListener
- Direct Known Subclasses:
ViewportInteractor
public abstract class AbstractInteractor extends Object implements Interactor
-
-
Constructor Summary
Constructors Modifier Constructor Description protected
AbstractInteractor()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
activate()
void
addListener(InteractorListener l)
protected void
cancelInteraction(InputEvent inputEvent)
void
deactivate()
Cursor
getCursor()
InteractorListener[]
getListeners()
boolean
isActive()
protected static boolean
isLeftMouseButtonDown(MouseEvent e)
protected static boolean
isMultiButton1Click(MouseEvent e)
protected static boolean
isSingleButton1Click(MouseEvent e)
void
keyPressed(KeyEvent event)
Invoked when a key has been pressed.void
keyReleased(KeyEvent event)
Invoked when a key has been released.void
keyTyped(KeyEvent event)
Invoked when a key has been typed.void
mouseClicked(MouseEvent event)
Invoked when the mouse button has been clicked (pressed and released) on a component.void
mouseDragged(MouseEvent event)
Invoked when a mouse button is pressed on a component and then dragged.void
mouseEntered(MouseEvent event)
Invoked when the mouse enters a component.void
mouseExited(MouseEvent event)
Invoked when the mouse exits a component.void
mouseMoved(MouseEvent event)
Invoked when the mouse cursor has been moved onto a component but no buttons have been pushed.void
mousePressed(MouseEvent event)
Invoked when a mouse button has been pressed on a component.void
mouseReleased(MouseEvent event)
Invoked when a mouse button has been released on a component.void
removeListener(InteractorListener l)
protected boolean
startInteraction(InputEvent inputEvent)
protected void
stopInteraction(InputEvent inputEvent)
-
-
-
Method Detail
-
isActive
public boolean isActive()
- Specified by:
isActive
in interfaceInteractor
-
activate
public boolean activate()
- Specified by:
activate
in interfaceInteractor
-
deactivate
public void deactivate()
- Specified by:
deactivate
in interfaceInteractor
-
getCursor
public Cursor getCursor()
- Specified by:
getCursor
in interfaceInteractor
-
mouseEntered
public void mouseEntered(MouseEvent event)
Invoked when the mouse enters a component.The default implementation does nothing.
- Specified by:
mouseEntered
in interfaceMouseListener
- Parameters:
event
- The mouse event.
-
mouseExited
public void mouseExited(MouseEvent event)
Invoked when the mouse exits a component.The default implementation does nothing.
- Specified by:
mouseExited
in interfaceMouseListener
- Parameters:
event
- The mouse event.
-
mousePressed
public void mousePressed(MouseEvent event)
Invoked when a mouse button has been pressed on a component.The default implementation does nothing.
- Specified by:
mousePressed
in interfaceMouseListener
- Parameters:
event
- The mouse event.
-
mouseReleased
public void mouseReleased(MouseEvent event)
Invoked when a mouse button has been released on a component.The default implementation does nothing.
- Specified by:
mouseReleased
in interfaceMouseListener
- Parameters:
event
- The mouse event.
-
mouseClicked
public void mouseClicked(MouseEvent event)
Invoked when the mouse button has been clicked (pressed and released) on a component.The default implementation does nothing.
- Specified by:
mouseClicked
in interfaceMouseListener
- Parameters:
event
- The mouse event.
-
mouseDragged
public void mouseDragged(MouseEvent event)
Invoked when a mouse button is pressed on a component and then dragged.MOUSE_DRAGGED
events will continue to be delivered to the component where the drag originated until the mouse button is released (regardless of whether the mouse position is within the bounds of the component).Due to platform-dependent Drag&Drop implementations,
MOUSE_DRAGGED
events may not be delivered during a native Drag&Drop operation.The default implementation does nothing.
- Specified by:
mouseDragged
in interfaceMouseMotionListener
- Parameters:
event
- The mouse event.
-
mouseMoved
public void mouseMoved(MouseEvent event)
Invoked when the mouse cursor has been moved onto a component but no buttons have been pushed.The default implementation does nothing.
- Specified by:
mouseMoved
in interfaceMouseMotionListener
- Parameters:
event
- The mouse event.
-
keyPressed
public void keyPressed(KeyEvent event)
Invoked when a key has been pressed. See the class description forKeyEvent
for a definition of a key pressed event.The default implementation does nothing.
- Specified by:
keyPressed
in interfaceKeyListener
- Parameters:
event
- The key event.
-
keyReleased
public void keyReleased(KeyEvent event)
Invoked when a key has been released. See the class description forKeyEvent
for a definition of a key released event.The default implementation does nothing.
- Specified by:
keyReleased
in interfaceKeyListener
- Parameters:
event
- The key event.
-
keyTyped
public void keyTyped(KeyEvent event)
Invoked when a key has been typed. See the class description forKeyEvent
for a definition of a key typed event.The default implementation calls
cancelInteraction(java.awt.event.InputEvent)
if the "ESC" key has been typed.- Specified by:
keyTyped
in interfaceKeyListener
- Parameters:
event
- The key event.
-
addListener
public void addListener(InteractorListener l)
- Specified by:
addListener
in interfaceInteractor
-
removeListener
public void removeListener(InteractorListener l)
- Specified by:
removeListener
in interfaceInteractor
-
getListeners
public InteractorListener[] getListeners()
- Specified by:
getListeners
in interfaceInteractor
-
startInteraction
protected boolean startInteraction(InputEvent inputEvent)
-
stopInteraction
protected void stopInteraction(InputEvent inputEvent)
-
cancelInteraction
protected void cancelInteraction(InputEvent inputEvent)
-
isSingleButton1Click
protected static boolean isSingleButton1Click(MouseEvent e)
-
isMultiButton1Click
protected static boolean isMultiButton1Click(MouseEvent e)
-
isLeftMouseButtonDown
protected static boolean isLeftMouseButtonDown(MouseEvent e)
-
-