org.jhotdraw.draw.tool
Class ImageTool
- java.lang.Object
-
- org.jhotdraw.beans.AbstractBean
-
- org.jhotdraw.draw.tool.AbstractTool
-
- org.jhotdraw.draw.tool.CreationTool
-
- org.jhotdraw.draw.tool.ImageTool
-
- All Implemented Interfaces:
- java.awt.event.KeyListener, java.awt.event.MouseListener, java.awt.event.MouseMotionListener, java.io.Serializable, java.lang.Cloneable, java.util.EventListener, Tool
public class ImageTool extends CreationTool
A tool to create new figures that implement the ImageHolderFigure interface, such as ImageFigure. The figure to be created is specified by a prototype.Immediately, after the ImageTool has been activated, it opens a JFileChooser, letting the user specify an image file. The the user then performs the following mouse gesture:
- Press the mouse button and drag the mouse over the DrawingView. This defines the bounds of the created figure.
Design PatternsPrototype
TheImageToolcreates new figures by cloning a prototypeImageHolderFigureobject.
Prototype:ImageHolderFigure; Client:ImageTool.- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Constructor and Description ImageTool(ImageHolderFigure prototype)Creates a new instance.ImageTool(ImageHolderFigure prototype, java.util.Map<AttributeKey,java.lang.Object> attributes)Creates a new instance.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method and Description voidactivate(DrawingEditor editor)Activates the tool for the given editor.booleanisUseFileDialog()voidsetUseFileDialog(boolean newValue)-
Methods inherited from class org.jhotdraw.draw.tool.CreationTool
deactivate, getPrototype, isToolDoneAfterCreation, mouseDragged, mousePressed, mouseReleased, setToolDoneAfterCreation, updateCursor
-
Methods inherited from class org.jhotdraw.draw.tool.AbstractTool
addToolListener, addUndoableEditListener, draw, editCopy, editCut, editDelete, editDuplicate, editPaste, getActionMap, getInputMap, getToolTipText, isActive, keyPressed, keyReleased, keyTyped, mouseClicked, mouseEntered, mouseExited, mouseMoved, removeToolListener, removeUndoableEditListener, setActionMap, setInputMap, supportsHandleInteraction
-
Methods inherited from class org.jhotdraw.beans.AbstractBean
addPropertyChangeListener, addPropertyChangeListener, clone, getPropertyChangeListeners, removePropertyChangeListener, removePropertyChangeListener
-
-
-
-
Constructor Detail
-
ImageTool
public ImageTool(ImageHolderFigure prototype)
Creates a new instance.
-
ImageTool
public ImageTool(ImageHolderFigure prototype, java.util.Map<AttributeKey,java.lang.Object> attributes)
Creates a new instance.
-
-
Method Detail
-
setUseFileDialog
public void setUseFileDialog(boolean newValue)
-
isUseFileDialog
public boolean isUseFileDialog()
-
activate
public void activate(DrawingEditor editor)
Description copied from interface:ToolActivates the tool for the given editor. This method is called whenever the user switches to this tool.- Specified by:
activatein interfaceTool- Overrides:
activatein classCreationTool
-
-
DataMelt 3.0 © DataMelt by jWork.ORG