Documentation of 'org.jhotdraw.draw.tool.TextCreationTool' Java class
TextCreationTool
org.jhotdraw.draw.tool

Class TextCreationTool

  • All Implemented Interfaces:
    java.awt.event.ActionListener, java.awt.event.KeyListener, java.awt.event.MouseListener, java.awt.event.MouseMotionListener, java.io.Serializable, java.lang.Cloneable, java.util.EventListener, Tool


    public class TextCreationTool
    extends CreationTool
    implements java.awt.event.ActionListener
    A tool to create figures which implement the TextHolderFigure interface, such as TextFigure. The figure to be created is specified by a prototype.

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

    1. Press the mouse button over an area on the DrawingView on which there isn't a text figure present. This defines the location of the figure.
    When the user has performed this mouse gesture, the TextCreationTool overlays a text field over the drawing where the user can enter the text for the Figure.
    Design Patterns

    Framework
    The text creation and editing tools and the TextHolderFigure interface define together the contracts of a smaller framework inside of the JHotDraw framework for structured drawing editors.
    Contract: TextHolderFigure, TextCreationTool, TextAreaCreationTool, TextEditingTool, TextAreaEditingTool, FloatingTextField, FloatingTextArea.

    Prototype
    The text creation tools create new figures by cloning a prototype TextHolderFigure object.
    Prototype: TextHolderFigure; Client: TextCreationTool, TextAreaCreationTool.


    See Also:
    Serialized Form
    • Constructor Detail

      • TextCreationTool

        public TextCreationTool(TextHolderFigure prototype)
        Creates a new instance.
      • TextCreationTool

        public TextCreationTool(TextHolderFigure prototype,
                                java.util.Map<AttributeKey,java.lang.Object> attributes)
        Creates a new instance.
    • Method Detail

      • deactivate

        public void deactivate(DrawingEditor editor)
        Description copied from interface: Tool
        Deactivates the tool. This method is called whenever the user switches to another tool.
        Specified by:
        deactivate in interface Tool
        Overrides:
        deactivate in class CreationTool
      • mousePressed

        public void mousePressed(java.awt.event.MouseEvent e)
        Creates a new figure at the location where the mouse was pressed.
        Specified by:
        mousePressed in interface java.awt.event.MouseListener
        Overrides:
        mousePressed in class CreationTool
      • mouseDragged

        public void mouseDragged(java.awt.event.MouseEvent e)
        Specified by:
        mouseDragged in interface java.awt.event.MouseMotionListener
        Overrides:
        mouseDragged in class CreationTool
      • mouseReleased

        public void mouseReleased(java.awt.event.MouseEvent evt)
        Specified by:
        mouseReleased in interface java.awt.event.MouseListener
        Overrides:
        mouseReleased in class CreationTool
      • keyReleased

        public void keyReleased(java.awt.event.KeyEvent evt)
        Specified by:
        keyReleased in interface java.awt.event.KeyListener
        Overrides:
        keyReleased in class AbstractTool
      • actionPerformed

        public void actionPerformed(java.awt.event.ActionEvent event)
        Specified by:
        actionPerformed in interface java.awt.event.ActionListener
      • isEditing

        public boolean isEditing()

DataMelt 3.0 © DataMelt by jWork.ORG

Ads help maintain this website.