public class FigureInteractor extends AbstractInteractor implements java.awt.event.KeyListener
| Red (cxh) |
| Yellow (ismael) |
| Constructor and Description |
|---|
FigureInteractor(AbstractFigure figure)
Construct a FigureInteractor for the given figure.
|
| Modifier and Type | Method and Description |
|---|---|
boolean |
isSelected()
Return whether or not a figure has been selected in the
viewscreen.
|
void |
keyPressed(java.awt.event.KeyEvent e)
Translate a selected figure according to which arrow key is
pressed.
|
void |
keyReleased(java.awt.event.KeyEvent e)
Included to comply with the KeyListener interface requirement.
|
void |
keyTyped(java.awt.event.KeyEvent e)
Included to comply with the KeyListener interface requirement.
|
void |
mouseClicked(LayerEvent layerEvent)
Included to comply with the AbstractListener implementation
requirement.
|
void |
mouseDragged(LayerEvent layerEvent)
Translate the figure to wherever the mouse is dragged.
|
void |
mouseEntered(LayerEvent layerEvent)
Included to comply with the AbstractListener implementation
requirement.
|
void |
mouseExited(LayerEvent layerEvent)
Included to comply with the AbstractListener implementation
requirement.
|
void |
mouseMoved(LayerEvent layerEvent)
Included to comply with the AbstractListener implementation
requirement.
|
void |
mousePressed(LayerEvent layerEvent)
Update the state of this listener to reflect where on the
figure the mouse button was pressed, and change the mouse
cursor to show that the figure can now be dragged.
|
void |
mouseReleased(LayerEvent layerEvent)
Included to comply with the AbstractListener implementation
requirement.
|
void |
setSelected(boolean selected)
Set whether the figure being listened to is selected or not selected.
|
void |
setViewScreen(ViewScreen2D viewScreen)
Notify this object of the view screen which contains the
figure this object is listening to.
|
accept, getMouseFilter, isConsuming, isEnabled, isMotionEnabled, setConsuming, setEnabled, setMotionEnabled, setMouseFilterpublic FigureInteractor(AbstractFigure figure)
figure - The figure this interactor is to listen and respond to.public boolean isSelected()
public void keyPressed(java.awt.event.KeyEvent e)
keyPressed in interface java.awt.event.KeyListenere - The KeyEvent received.public void keyReleased(java.awt.event.KeyEvent e)
keyReleased in interface java.awt.event.KeyListenere - The KeyEvent received.public void keyTyped(java.awt.event.KeyEvent e)
keyTyped in interface java.awt.event.KeyListenere - The KeyEvent received.public void mouseClicked(LayerEvent layerEvent)
mouseClicked in interface LayerListenermouseClicked in class AbstractInteractorlayerEvent - The LayerEvent received.public void mouseDragged(LayerEvent layerEvent)
mouseDragged in interface LayerListenermouseDragged in class AbstractInteractorlayerEvent - The LayerEvent received.public void mouseEntered(LayerEvent layerEvent)
mouseEntered in interface LayerMotionListenermouseEntered in class AbstractInteractorlayerEvent - The LayerEvent received.public void mouseExited(LayerEvent layerEvent)
mouseExited in interface LayerMotionListenermouseExited in class AbstractInteractorlayerEvent - The LayerEvent received.public void mouseMoved(LayerEvent layerEvent)
mouseMoved in interface LayerMotionListenermouseMoved in class AbstractInteractorlayerEvent - The LayerEvent received.public void mousePressed(LayerEvent layerEvent)
mousePressed in interface LayerListenermousePressed in class AbstractInteractorlayerEvent - The LayerEvent received.public void mouseReleased(LayerEvent layerEvent)
mouseReleased in interface LayerListenermouseReleased in class AbstractInteractorlayerEvent - The LayerEvent received.public void setSelected(boolean selected)
selected - true if the figure being listened to is
selected, false otherwise.public void setViewScreen(ViewScreen2D viewScreen)
viewScreen - The viewScreen containing the figure this
interactor is listening to.