Package diva.gui.toolbox
Class MenuCreator
- java.lang.Object
-
- diva.canvas.interactor.AbstractInteractor
-
- diva.gui.toolbox.MenuCreator
-
- All Implemented Interfaces:
LayerListener
,LayerMotionListener
,Interactor
,java.util.EventListener
public class MenuCreator extends AbstractInteractor
This interactor creates a menu when it is activated. By default, this interactor is associated with the right mouse button. This class is commonly used to create context sensitive menus for figures in a canvas.- Version:
- $Id$
- Author:
- Stephen Neuendorffer
-
-
Constructor Summary
Constructors Constructor Description MenuCreator(MenuFactory factory)
Construct a new interactor with a right button mouse filter.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description MenuFactory
getMenuFactory()
Return the menu factory.void
mousePressed(LayerEvent e)
When a mouse press happens, ask the factory to create a menu and show it on the screen.void
mouseReleased(LayerEvent e)
When a mouse press happens, ask the factory to create a menu and show it on the screen.void
setMenuFactory(MenuFactory factory)
Set the menu factory.-
Methods inherited from class diva.canvas.interactor.AbstractInteractor
accept, getMouseFilter, isConsuming, isEnabled, isMotionEnabled, mouseClicked, mouseDragged, mouseEntered, mouseExited, mouseMoved, setConsuming, setEnabled, setMotionEnabled, setMouseFilter
-
-
-
-
Constructor Detail
-
MenuCreator
public MenuCreator(MenuFactory factory)
Construct a new interactor with a right button mouse filter. Set the menu factory to the given factory.
-
-
Method Detail
-
getMenuFactory
public MenuFactory getMenuFactory()
Return the menu factory.
-
mousePressed
public void mousePressed(LayerEvent e)
When a mouse press happens, ask the factory to create a menu and show it on the screen. Consume the mouse event. If the factory is set to null, then ignore the event and do not consume it.- Specified by:
mousePressed
in interfaceLayerListener
- Overrides:
mousePressed
in classAbstractInteractor
- Parameters:
e
- The event
-
mouseReleased
public void mouseReleased(LayerEvent e)
When a mouse press happens, ask the factory to create a menu and show it on the screen. Consume the mouse event. If the factory is set to null, then ignore the event and do not consume it.- Specified by:
mouseReleased
in interfaceLayerListener
- Overrides:
mouseReleased
in classAbstractInteractor
- Parameters:
e
- The event
-
setMenuFactory
public void setMenuFactory(MenuFactory factory)
Set the menu factory.
-
-