Package mgui.interfaces.tools.graphics
Class Tool2D
java.lang.Object
mgui.interfaces.tools.graphics.Tool2D
- All Implemented Interfaces:
java.lang.Cloneable,PopupMenuObject,Tool,ToolInputListener,IconObject
- Direct Known Subclasses:
ToolCreateEllipse2D,ToolCreateImage2D,ToolCreateImage3D,ToolCreatePolygon2D,ToolCreateRect2D,ToolDZoom2D,ToolPan2D,ToolQueryShape2D,ToolReversePolygon2D,ToolSelectShape2D,ToolWindowZoom2D,ToolZoomExt2D
public abstract class Tool2D extends java.lang.Object implements Tool
Abstract class for a Tool which operates on an
InterfaceGraphic2D window.- Since:
- 1.0
- Version:
- 1.0
- Author:
- Andrew Reid
-
Field Summary
Fields Modifier and Type Field Description protected javax.swing.Iconiconprotected booleanis_activebooleanisImmediateprotected Tool2Dlast_toolprotected java.util.ArrayList<ToolListener>listenersjava.lang.StringnameInterfaceGraphic2DtargetPanelShape2DInttargetShapeinttoolPhase -
Constructor Summary
Constructors Constructor Description Tool2D() -
Method Summary
Modifier and Type Method Description voidactivate()Should be called once a tool is activated within a particular InterfaceDisplayPanel.voidaddListener(ToolListener tl)abstract java.lang.Objectclone()voiddeactivate()Should be called once a tool is deactivated; instances of Tool should perform clean-up activities here.protected voidfireListeners()protected voidfireListeners(ToolEvent event)java.lang.StringgetName()javax.swing.IcongetObjectIcon()Returns theIconassociated with this object.InterfacePopupMenugetPopupMenu()Produces and returns a popup menu for this object.InterfacePopupMenugetPopupMenu(java.util.List<java.lang.Object> selected)Produces and returns a popup menu for this object.ToolgetPreviousTool()Returns the tool that was set previous to this one, if one existsvoidhandlePopupEvent(java.awt.event.ActionEvent e)Handles an event on this object's popup menu.abstract voidhandleToolEvent(ToolInputEvent e)Handle this tool eventbooleanisExclusive()Specifies whether this tool requires exclusively; otherwise it will run in parallel with the default tool, if one exists.booleanisImmediate()Specifies whether this tool is immediate; this indicates that it should be run immediately upon calling and stop, rather than wait for AWT events.voidremoveListener(ToolListener tl)protected voidsetIcon()voidsetTargetPanel(InterfacePanel panel)voidsetTargetShape(Shape2DInt thisShape)voidshowPopupMenu(java.awt.event.MouseEvent e)Shows a popup menu at the point of the givenMouseEvent.Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Field Details
-
targetShape
-
targetPanel
-
toolPhase
public int toolPhase -
name
public java.lang.String name -
isImmediate
public boolean isImmediate -
listeners
-
icon
protected javax.swing.Icon icon -
last_tool
-
is_active
protected boolean is_active
-
-
Constructor Details
-
Tool2D
public Tool2D()
-
-
Method Details
-
activate
public void activate()Description copied from interface:ToolShould be called once a tool is activated within a particular InterfaceDisplayPanel. -
deactivate
public void deactivate()Description copied from interface:ToolShould be called once a tool is deactivated; instances of Tool should perform clean-up activities here.- Specified by:
deactivatein interfaceTool
-
getPreviousTool
Description copied from interface:ToolReturns the tool that was set previous to this one, if one exists- Specified by:
getPreviousToolin interfaceTool- Returns:
-
isExclusive
public boolean isExclusive()Description copied from interface:ToolSpecifies whether this tool requires exclusively; otherwise it will run in parallel with the default tool, if one exists.- Specified by:
isExclusivein interfaceTool- Returns:
-
addListener
- Specified by:
addListenerin interfaceTool
-
removeListener
- Specified by:
removeListenerin interfaceTool
-
setTargetShape
-
setTargetPanel
- Specified by:
setTargetPanelin interfaceTool
-
handleToolEvent
Description copied from interface:ToolInputListenerHandle this tool event- Specified by:
handleToolEventin interfaceToolInputListener
-
isImmediate
public boolean isImmediate()Description copied from interface:ToolSpecifies whether this tool is immediate; this indicates that it should be run immediately upon calling and stop, rather than wait for AWT events.- Specified by:
isImmediatein interfaceTool- Returns:
-
getName
public java.lang.String getName() -
clone
public abstract java.lang.Object clone() -
fireListeners
protected void fireListeners() -
fireListeners
-
getObjectIcon
public javax.swing.Icon getObjectIcon()Description copied from interface:IconObjectReturns theIconassociated with this object.- Specified by:
getObjectIconin interfaceIconObject- Returns:
-
setIcon
protected void setIcon() -
getPopupMenu
Description copied from interface:PopupMenuObjectProduces and returns a popup menu for this object.- Specified by:
getPopupMenuin interfacePopupMenuObject- Returns:
-
getPopupMenu
Description copied from interface:PopupMenuObjectProduces and returns a popup menu for this object. Allows an associated list of objects to be passed as an argument.- Specified by:
getPopupMenuin interfacePopupMenuObject- Returns:
-
handlePopupEvent
public void handlePopupEvent(java.awt.event.ActionEvent e)Description copied from interface:PopupMenuObjectHandles an event on this object's popup menu.- Specified by:
handlePopupEventin interfacePopupMenuObject
-
showPopupMenu
public void showPopupMenu(java.awt.event.MouseEvent e)Description copied from interface:PopupMenuObjectShows a popup menu at the point of the givenMouseEvent.- Specified by:
showPopupMenuin interfacePopupMenuObject
-