Class EditingTool

  • All Implemented Interfaces:
    Overlay, java.awt.event.KeyListener, java.awt.event.MouseListener, java.awt.event.MouseMotionListener, java.util.EventListener

    public class EditingTool
    extends java.lang.Object
    implements java.awt.event.MouseListener, java.awt.event.MouseMotionListener, java.awt.event.KeyListener, Overlay
    Author:
    Fabrizio Giudici
    • Field Detail

      • CHANGED_ATTRIBUTE

        public static final java.lang.String CHANGED_ATTRIBUTE
    • Method Detail

      • setEnabled

        public void setEnabled​(boolean enabled)
      • isEnabled

        public boolean isEnabled()
      • isActive

        public boolean isActive()
      • commitChanges

        public void commitChanges()
        Programmatically commits the changes. E.g. called by the save of an image editor when a tools is currently on.
      • activate

        public void activate()
      • deactivate

        public void deactivate()
      • imageChanged

        public void imageChanged()
        Invoked when the renderer changes the image being edited by this tool. By default, the tool is deactivated (by invoking deactivate()), but you can change the default behaviour by overriding this method (for instance, committing changes).
      • reset

        public void reset()
      • setIcon

        public void setIcon​(javax.swing.Icon icon)
      • isVisible

        public final boolean isVisible()
        Specified by:
        isVisible in interface Overlay
      • connectButton

        public void connectButton​(javax.swing.JToggleButton button)
      • setInitialState

        protected void setInitialState​(java.lang.Class<? extends EditingTool.State> initialStateClass)
      • setState

        protected void setState​(java.lang.Class<? extends EditingTool.State> newStateClass)
      • repaint

        protected void repaint()
      • makeCursor

        protected java.awt.Cursor makeCursor​(javax.swing.Icon icon,
                                             java.lang.String name)
      • mouseClicked

        public final void mouseClicked​(java.awt.event.MouseEvent event)
        Specified by:
        mouseClicked in interface java.awt.event.MouseListener
      • mousePressed

        public final void mousePressed​(java.awt.event.MouseEvent event)
        Specified by:
        mousePressed in interface java.awt.event.MouseListener
      • mouseReleased

        public final void mouseReleased​(java.awt.event.MouseEvent event)
        Specified by:
        mouseReleased in interface java.awt.event.MouseListener
      • mouseEntered

        public final void mouseEntered​(java.awt.event.MouseEvent event)
        Specified by:
        mouseEntered in interface java.awt.event.MouseListener
      • mouseExited

        public final void mouseExited​(java.awt.event.MouseEvent event)
        Specified by:
        mouseExited in interface java.awt.event.MouseListener
      • mouseDragged

        public final void mouseDragged​(java.awt.event.MouseEvent event)
        Specified by:
        mouseDragged in interface java.awt.event.MouseMotionListener
      • mouseMoved

        public final void mouseMoved​(java.awt.event.MouseEvent event)
        Specified by:
        mouseMoved in interface java.awt.event.MouseMotionListener
      • keyTyped

        public final void keyTyped​(java.awt.event.KeyEvent event)
        Specified by:
        keyTyped in interface java.awt.event.KeyListener
      • keyPressed

        public final void keyPressed​(java.awt.event.KeyEvent event)
        Specified by:
        keyPressed in interface java.awt.event.KeyListener
      • keyReleased

        public final void keyReleased​(java.awt.event.KeyEvent event)
        Specified by:
        keyReleased in interface java.awt.event.KeyListener
      • paint

        public final void paint​(java.awt.Graphics2D g,
                                EditableImageRenderer imageRenderer)
        Description copied from interface: Overlay
        As the Graphics2D object passed is a copy of the original, this method can change attributes (e.g. color, clip) without worrying about restoring them to their original values.
        Specified by:
        paint in interface Overlay