JHotDraw 7.1

org.jhotdraw.draw
Class ImageTool

java.lang.Object
  extended by org.jhotdraw.beans.AbstractBean
      extended by org.jhotdraw.draw.AbstractTool
          extended by org.jhotdraw.draw.CreationTool
              extended by org.jhotdraw.draw.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.

To create a figure using the ImageTool, the user does the following mouse gestures on a DrawingView:

  1. Press the mouse button over the DrawingView. This defines the upper left point of the Figure bounds.
When the user has performed this mouse gestures, the ImageTool opens a JFileChooser where the user can specify an image file to be loaded into the figure. The width and height of the image is used to determine the lower right corner of the Figure.

Version:
1.0 December 14, 2006 Created.
Author:
Werner Randelshofer
See Also:
Serialized Form

Field Summary
 
Fields inherited from class org.jhotdraw.draw.CreationTool
createdFigure
 
Fields inherited from class org.jhotdraw.draw.AbstractTool
anchor, editor, isWorking, listenerList
 
Fields inherited from class org.jhotdraw.beans.AbstractBean
propertySupport
 
Constructor Summary
ImageTool(ImageHolderFigure prototype)
          Creates a new instance.
ImageTool(ImageHolderFigure prototype, java.util.Map attributes)
          Creates a new instance.
 
Method Summary
 void creationFinished(Figure createdFigure)
          This method allows subclasses to do perform additonal user interactions after the new figure has been created.
 
Methods inherited from class org.jhotdraw.draw.CreationTool
activate, createFigure, deactivate, getAddedFigure, getCreatedFigure, getPrototype, isToolDoneAfterCreation, mouseDragged, mousePressed, mouseReleased, setToolDoneAfterCreation
 
Methods inherited from class org.jhotdraw.draw.AbstractTool
addToolListener, addUndoableEditListener, constrainPoint, constrainPoint, createActionMap, createInputMap, draw, editCopy, editCut, editDelete, editDuplicate, editPaste, fireAreaInvalidated, fireAreaInvalidated, fireToolDone, fireToolStarted, getActionMap, getDrawing, getEditor, getInputMap, getView, isActive, keyPressed, keyReleased, keyTyped, mouseClicked, mouseEntered, mouseExited, mouseMoved, removeToolListener, removeUndoableEditListener, setActionMap, setInputMap, updateCursor, viewToDrawing
 
Methods inherited from class org.jhotdraw.beans.AbstractBean
addPropertyChangeListener, addPropertyChangeListener, clone, firePropertyChange, firePropertyChange, firePropertyChange, removePropertyChangeListener, removePropertyChangeListener
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ImageTool

public ImageTool(ImageHolderFigure prototype)
Creates a new instance.


ImageTool

public ImageTool(ImageHolderFigure prototype,
                 java.util.Map attributes)
Creates a new instance.

Method Detail

creationFinished

public void creationFinished(Figure createdFigure)
Description copied from class: CreationTool
This method allows subclasses to do perform additonal user interactions after the new figure has been created. The implementation of this class just invokes fireToolDone.

Overrides:
creationFinished in class CreationTool

Copyright 1996-2007 (c) JHotDraw.org.
Some rights reserved.