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 Patterns
Prototype
The ImageTool
creates new figures by cloning a prototype
ImageHolderFigure
object.
Prototype: ImageHolderFigure
; Client: ImageTool
.
- Version:
- $Id: ImageTool.java 647 2010-01-24 22:52:59Z rawcoder $
- Author:
- Werner Randelshofer
- See Also:
- Serialized Form
Methods inherited from class org.jhotdraw.draw.tool.CreationTool |
createFigure, creationFinished, deactivate, getAddedFigure, getCreatedFigure, getPrototype, isToolDoneAfterCreation, mouseDragged, mousePressed, mouseReleased, setToolDoneAfterCreation, updateCursor |
Methods inherited from class org.jhotdraw.draw.tool.AbstractTool |
addToolListener, addUndoableEditListener, constrainPoint, constrainPoint, createActionMap, createInputMap, draw, editCopy, editCut, editDelete, editDuplicate, editPaste, fireAreaInvalidated, fireAreaInvalidated, fireBoundsInvalidated, fireToolDone, fireToolStarted, getActionMap, getDrawing, getEditor, getInputMap, getToolTipText, getView, isActive, keyPressed, keyReleased, keyTyped, maybeFireBoundsInvalidated, mouseClicked, mouseEntered, mouseExited, mouseMoved, removeToolListener, removeUndoableEditListener, setActionMap, setInputMap, supportsHandleInteraction, viewToDrawing |
Methods inherited from class java.lang.Object |
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
fileDialog
protected java.awt.FileDialog fileDialog
fileChooser
protected javax.swing.JFileChooser fileChooser
useFileDialog
protected boolean useFileDialog
workerThread
protected java.lang.Thread workerThread
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.
setUseFileDialog
public void setUseFileDialog(boolean newValue)
isUseFileDialog
public boolean isUseFileDialog()
activate
public void activate(DrawingEditor editor)
- Description copied from interface:
Tool
- Activates the tool for the given editor. This method is called
whenever the user switches to this tool.
- Specified by:
activate
in interface Tool
- Overrides:
activate
in class CreationTool