java.lang.Object
java.awt.Component
java.awt.Canvas
ij.gui.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:
-
Nested Class Summary
Nested classes/interfaces inherited from class java.awt.Canvas
Canvas.AccessibleAWTCanvas
Nested classes/interfaces inherited from class java.awt.Component
Component.AccessibleAWTComponent, Component.BaselineResizeBehavior, Component.BltBufferStrategy, Component.FlipBufferStrategy
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final int
static final int
static final String[]
static final String
static final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
Obsolete public constantsstatic final int
Obsolete public constantsstatic final int
Obsolete public constantsstatic final int
Obsolete public constantsstatic final int
Obsolete public constantsstatic final int
Obsolete public constantsstatic final int
Obsolete public constantsstatic final int
Obsolete public constantsstatic final int
Obsolete public constantsstatic final int
static String
static final int
static final int
Fields inherited from class java.awt.Component
accessibleContext, BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT
Fields inherited from interface java.awt.image.ImageObserver
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoid
void
addMacroTool
(String name, MacroInstaller macroInstaller) Used by the MacroInstaller class to add a macro tool to the toolbar.void
addMacroTool
(String name, MacroInstaller macroInstaller, int id) Used by the MacroInstaller class to install a set of macro tools.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.int
Adds a tool to the toolbar.static Color
static double
static int
Returns the size of the selection brush tool, or 0 if the brush tool is not enabled.static int
Returns the button width (button spacing).getColor()
Deprecated.replaced by getForegroundColor()static Color
static double
static Toolbar
Returns a reference to the ImageJ toolbar.static boolean
Returns 'true' if the multi-point tool is enabled.int
static int
Returns the oval tool type (OVAL_ROI, ELLIPSE_ROI or BRUSH_ROI).static PlugInTool
static int
Returns the rectangle tool type (RECT_ROI, ROUNDED_RECT_ROI or ROTATED_RECT_ROI).static int
Returns the rounded rectangle arc size, or 0 if the rounded rectangle tool is not enabled.static int
Returns the ID of the current tool (Toolbar.RECTANGLE, Toolbar.OVAL, etc.).int
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.static String
Returns the name of the current tool.void
init()
static boolean
void
void
void
void
void
void
void
void
void
void
static void
static void
repaintTool
(int tool) void
static void
static void
static void
setBackgroundValue
(double value) Sets the background color to grayscale, where value is between 0 (black) and 255 (white).static void
setBrushSize
(int size) Set the size of the selection brush tool, in pixels.void
Deprecated.replaced by setForegroundColor()static void
static void
setForegroundValue
(double value) Sets the foreground color to grayscale, where value is between 0 (black) and 255 (white).static void
Sets the icon of the specified macro or plugin tool.
See: Help>Examples>Tool>Animated Icon Tool;static void
setLongClickDelay
(int delay) Sets the tool menu long click delay in milliseconds (default is 600).static void
setRoundRectArcSize
(int size) Sets the rounded rectangle corner diameter (pixels).void
setTool
(int tool) boolean
static void
void
triggerPopupMenu
(int newTool, MouseEvent e, boolean isRightClick, boolean isLongPress) Methods inherited from class java.awt.Canvas
addNotify, createBufferStrategy, createBufferStrategy, getAccessibleContext, getBufferStrategy, update
Methods inherited from class java.awt.Component
action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, addPropertyChangeListener, addPropertyChangeListener, applyComponentOrientation, areFocusTraversalKeysSet, bounds, checkImage, checkImage, coalesceEvents, contains, contains, createImage, createImage, createVolatileImage, createVolatileImage, deliverEvent, disable, disableEvents, dispatchEvent, doLayout, enable, enable, enableEvents, enableInputMethods, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getAlignmentX, getAlignmentY, getBackground, getBaseline, getBaselineResizeBehavior, getBounds, getBounds, getColorModel, getComponentAt, getComponentAt, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusCycleRootAncestor, getFocusListeners, getFocusTraversalKeys, getFocusTraversalKeysEnabled, getFont, getFontMetrics, getForeground, getGraphics, getGraphicsConfiguration, getHeight, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputContext, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getListeners, getLocale, getLocation, getLocation, getLocationOnScreen, getMaximumSize, getMouseListeners, getMouseMotionListeners, getMousePosition, getMouseWheelListeners, getName, getParent, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getSize, getToolkit, getTreeLock, getWidth, getX, getY, gotFocus, handleEvent, hasFocus, hide, imageUpdate, inside, invalidate, isBackgroundSet, isCursorSet, isDisplayable, isDoubleBuffered, isEnabled, isFocusable, isFocusCycleRoot, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isMaximumSizeSet, isMinimumSizeSet, isOpaque, isPreferredSizeSet, isShowing, isValid, isVisible, keyDown, keyUp, layout, list, list, list, list, list, locate, location, lostFocus, minimumSize, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, paramString, postEvent, preferredSize, prepareImage, prepareImage, print, printAll, processComponentEvent, processEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processKeyEvent, processMouseEvent, processMouseMotionEvent, processMouseWheelEvent, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removeNotify, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, repaint, requestFocus, requestFocus, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, requestFocusInWindow, reshape, resize, resize, revalidate, setBackground, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setEnabled, setFocusable, setFocusTraversalKeys, setFocusTraversalKeysEnabled, setFont, setForeground, setIgnoreRepaint, setLocale, setLocation, setLocation, setMaximumSize, setMinimumSize, setMixingCutoutShape, setName, setPreferredSize, setSize, setSize, setVisible, show, show, size, toString, transferFocus, transferFocusBackward, transferFocusUpCycle, validate
-
Field Details
-
RECTANGLE
public static final int RECTANGLE- See Also:
-
OVAL
public static final int OVAL- See Also:
-
POLYGON
public static final int POLYGON- See Also:
-
FREEROI
public static final int FREEROI- See Also:
-
LINE
public static final int LINE- See Also:
-
POLYLINE
public static final int POLYLINE- See Also:
-
FREELINE
public static final int FREELINE- See Also:
-
POINT
public static final int POINT- See Also:
-
CROSSHAIR
public static final int CROSSHAIR- See Also:
-
WAND
public static final int WAND- See Also:
-
TEXT
public static final int TEXT- See Also:
-
UNUSED
public static final int UNUSED- See Also:
-
MAGNIFIER
public static final int MAGNIFIER- See Also:
-
HAND
public static final int HAND- See Also:
-
DROPPER
public static final int DROPPER- See Also:
-
ANGLE
public static final int ANGLE- See Also:
-
CUSTOM1
public static final int CUSTOM1- See Also:
-
CUSTOM2
public static final int CUSTOM2- See Also:
-
CUSTOM3
public static final int CUSTOM3- See Also:
-
CUSTOM4
public static final int CUSTOM4- See Also:
-
CUSTOM5
public static final int CUSTOM5- See Also:
-
CUSTOM6
public static final int CUSTOM6- See Also:
-
CUSTOM7
public static final int CUSTOM7- See Also:
-
DOUBLE_CLICK_THRESHOLD
public static final int DOUBLE_CLICK_THRESHOLD- See Also:
-
RECT_ROI
public static final int RECT_ROI- See Also:
-
ROUNDED_RECT_ROI
public static final int ROUNDED_RECT_ROI- See Also:
-
ROTATED_RECT_ROI
public static final int ROTATED_RECT_ROI- See Also:
-
OVAL_ROI
public static final int OVAL_ROI- See Also:
-
ELLIPSE_ROI
public static final int ELLIPSE_ROI- See Also:
-
BRUSH_ROI
public static final int BRUSH_ROI- See Also:
-
builtInTools
-
CORNER_DIAMETER
- See Also:
-
TOOL_KEY
-
SPARE1
public static final int SPARE1Obsolete public constants- See Also:
-
SPARE2
public static final int SPARE2Obsolete public constants- See Also:
-
SPARE3
public static final int SPARE3Obsolete public constants- See Also:
-
SPARE4
public static final int SPARE4Obsolete public constants- See Also:
-
SPARE5
public static final int SPARE5Obsolete public constants- See Also:
-
SPARE6
public static final int SPARE6Obsolete public constants- See Also:
-
SPARE7
public static final int SPARE7Obsolete public constants- See Also:
-
SPARE8
public static final int SPARE8Obsolete public constants- See Also:
-
SPARE9
public static final int SPARE9Obsolete public constants- See Also:
-
-
Constructor Details
-
Toolbar
public Toolbar()
-
-
Method Details
-
init
public void init() -
getToolId
public static int getToolId()Returns the ID of the current tool (Toolbar.RECTANGLE, Toolbar.OVAL, etc.). -
getToolId
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
Returns a reference to the ImageJ toolbar. -
paint
-
setTool
-
getToolName
Returns the name of the current tool. -
setTool
public void setTool(int tool) -
getColor
Deprecated.replaced by getForegroundColor() -
setColor
Deprecated.replaced by setForegroundColor() -
getForegroundColor
-
setForegroundColor
-
getBackgroundColor
-
setBackgroundColor
-
getForegroundValue
public static double getForegroundValue() -
setForegroundValue
public static void setForegroundValue(double value) Sets the foreground color to grayscale, where value is between 0 (black) and 255 (white). -
getBackgroundValue
public static double getBackgroundValue() -
setBackgroundValue
public static void setBackgroundValue(double value) Sets the background color to grayscale, where value is between 0 (black) and 255 (white). -
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. -
getRectToolType
public static int getRectToolType()Returns the rectangle tool type (RECT_ROI, ROUNDED_RECT_ROI or ROTATED_RECT_ROI). -
getOvalToolType
public static int getOvalToolType()Returns the oval tool type (OVAL_ROI, ELLIPSE_ROI or BRUSH_ROI). -
getButtonSize
public static int getButtonSize()Returns the button width (button spacing). -
repaintTool
public static void repaintTool(int tool) -
triggerPopupMenu
-
mousePressed
- Specified by:
mousePressed
in interfaceMouseListener
-
mouseReleased
- Specified by:
mouseReleased
in interfaceMouseListener
-
restorePreviousTool
public void restorePreviousTool() -
mouseExited
- Specified by:
mouseExited
in interfaceMouseListener
-
mouseClicked
- Specified by:
mouseClicked
in interfaceMouseListener
-
mouseEntered
- Specified by:
mouseEntered
in interfaceMouseListener
-
mouseDragged
- Specified by:
mouseDragged
in interfaceMouseMotionListener
-
itemStateChanged
- Specified by:
itemStateChanged
in interfaceItemListener
-
restoreTools
public static void restoreTools() -
actionPerformed
- Specified by:
actionPerformed
in interfaceActionListener
-
getPreferredSize
- Overrides:
getPreferredSize
in classComponent
-
getMinimumSize
- Overrides:
getMinimumSize
in classComponent
-
mouseMoved
- Specified by:
mouseMoved
in interfaceMouseMotionListener
-
addTool
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
Used by the MacroInstaller class to install a set of macro tools. -
addMacroTool
Used by the MacroInstaller class to add a macro tool to the toolbar. -
removeMacroTools
public static void removeMacroTools() -
addPlugInTool
Adds a plugin tool to the first available toolbar slot, or to the last slot if the toolbar is full. -
getPlugInTool
-
installStartupTools
public void installStartupTools() -
showCode
-
installStartupMacrosTools
public static boolean installStartupMacrosTools() -
getNumTools
public int getNumTools() -
setLongClickDelay
public static void setLongClickDelay(int delay) Sets the tool menu long click delay in milliseconds (default is 600). Set to 0 to disable long click triggering. -
setIcon
Sets the icon of the specified macro or plugin tool.
See: Help>Examples>Tool>Animated Icon Tool;
-