Package ij.gui

Class Toolbar

All Implemented Interfaces:
ActionListener, ItemListener, MouseListener, MouseMotionListener, ImageObserver, MenuContainer, Serializable, EventListener, Accessible

public class Toolbar extends Canvas implements MouseListener, MouseMotionListener, ItemListener, ActionListener
The ImageJ toolbar.
See Also:
  • Field Details

  • Constructor Details

    • Toolbar

      public Toolbar()
  • Method Details

    • getToolId

      public static int getToolId()
      Returns the ID of the current tool (Toolbar.RECTANGLE, Toolbar.OVAL, etc.).
    • getToolId

      public int getToolId(String name)
      Returns the ID of the tool whose name (the description displayed in the status bar) starts with the specified string, or -1 if the tool is not found.
    • getInstance

      public static Toolbar getInstance()
      Returns a reference to the ImageJ toolbar.
    • paint

      public void paint(Graphics g)
      Overrides:
      paint in class Canvas
    • setTool

      public boolean setTool(String name)
    • getToolName

      public static String getToolName()
      Returns the name of the current tool.
    • setTool

      public void setTool(int tool)
    • getColor

      public Color getColor()
      Deprecated.
      replaced by getForegroundColor()
    • setColor

      public void setColor(Color c)
      Deprecated.
      replaced by setForegroundColor()
    • getForegroundColor

      public static Color getForegroundColor()
    • setForegroundColor

      public static void setForegroundColor(Color c)
    • getBackgroundColor

      public static Color getBackgroundColor()
    • setBackgroundColor

      public static void setBackgroundColor(Color c)
    • getBrushSize

      public static int getBrushSize()
      Returns the size of the selection brush tool, or 0 if the brush tool is not enabled.
    • setBrushSize

      public static void setBrushSize(int size)
      Set the size of the selection brush tool, in pixels.
    • getRoundRectArcSize

      public static int getRoundRectArcSize()
      Returns the rounded rectangle arc size, or 0 if the rounded rectangle tool is not enabled.
    • setRoundRectArcSize

      public static void setRoundRectArcSize(int size)
      Sets the rounded rectangle corner diameter (pixels).
    • getMultiPointMode

      public static boolean getMultiPointMode()
      Returns 'true' if the multi-point tool is enabled.
    • getOvalToolType

      public static int getOvalToolType()
      Returns the oval tool type (OVAL_ROI, ELLIPSE_ROI or BRUSH_ROI).
    • getButtonSize

      public static int getButtonSize()
    • mousePressed

      public void mousePressed(MouseEvent e)
      Specified by:
      mousePressed in interface MouseListener
    • restorePreviousTool

      public void restorePreviousTool()
    • mouseReleased

      public void mouseReleased(MouseEvent e)
      Specified by:
      mouseReleased in interface MouseListener
    • mouseExited

      public void mouseExited(MouseEvent e)
      Specified by:
      mouseExited in interface MouseListener
    • mouseClicked

      public void mouseClicked(MouseEvent e)
      Specified by:
      mouseClicked in interface MouseListener
    • mouseEntered

      public void mouseEntered(MouseEvent e)
      Specified by:
      mouseEntered in interface MouseListener
    • mouseDragged

      public void mouseDragged(MouseEvent e)
      Specified by:
      mouseDragged in interface MouseMotionListener
    • itemStateChanged

      public void itemStateChanged(ItemEvent e)
      Specified by:
      itemStateChanged in interface ItemListener
    • restoreTools

      public static void restoreTools()
    • actionPerformed

      public void actionPerformed(ActionEvent e)
      Specified by:
      actionPerformed in interface ActionListener
    • getPreferredSize

      public Dimension getPreferredSize()
      Overrides:
      getPreferredSize in class Component
    • getMinimumSize

      public Dimension getMinimumSize()
      Overrides:
      getMinimumSize in class Component
    • mouseMoved

      public void mouseMoved(MouseEvent e)
      Specified by:
      mouseMoved in interface MouseMotionListener
    • addTool

      public int addTool(String toolTip)
      Adds a tool to the toolbar. The 'toolTip' string is displayed in the status bar when the mouse is over the tool icon. The 'toolTip' string may include icon (http://imagej.nih.gov/ij/developer/macro/macros.html#tools). Returns the tool ID, or -1 if all tool slots are in use.
    • addMacroTool

      public void addMacroTool(String name, MacroInstaller macroInstaller, int id)
      Used by the MacroInstaller class to install a set of macro tools.
    • addMacroTool

      public void addMacroTool(String name, MacroInstaller macroInstaller)
      Used by the MacroInstaller class to add a macro tool to the toolbar.
    • removeMacroTools

      public static void removeMacroTools()
    • addPlugInTool

      public static void addPlugInTool(PlugInTool tool)
      Adds a plugin tool to the first available toolbar slot, or to the last slot if the toolbar is full.
    • getPlugInTool

      public static PlugInTool getPlugInTool()
    • installStartupTools

      public void installStartupTools()
    • installStartupMacrosTools

      public static boolean installStartupMacrosTools()
    • getNumTools

      public int getNumTools()