ij.gui
Class Toolbar

java.lang.Object
  extended by java.awt.Component
      extended by java.awt.Container
          extended by javax.swing.JComponent
              extended by ij.gui.Toolbar
All Implemented Interfaces:
java.awt.event.ActionListener, java.awt.event.ItemListener, java.awt.event.MouseListener, java.awt.event.MouseMotionListener, java.awt.image.ImageObserver, java.awt.MenuContainer, java.beans.PropertyChangeListener, java.io.Serializable, java.util.EventListener

public class Toolbar
extends javax.swing.JComponent
implements java.awt.event.MouseListener, java.awt.event.MouseMotionListener, java.awt.event.ItemListener, java.beans.PropertyChangeListener, java.awt.event.ActionListener

The ImageJ2x toolbar.

See Also:
Serialized Form

Nested Class Summary
 
Nested classes/interfaces inherited from class javax.swing.JComponent
javax.swing.JComponent.AccessibleJComponent
 
Nested classes/interfaces inherited from class java.awt.Container
java.awt.Container.AccessibleAWTContainer
 
Nested classes/interfaces inherited from class java.awt.Component
java.awt.Component.AccessibleAWTComponent, java.awt.Component.BaselineResizeBehavior, java.awt.Component.BltBufferStrategy, java.awt.Component.FlipBufferStrategy
 
Field Summary
static int ANGLE
           
static int BRUSH_ROI
           
static java.lang.String CORNER_DIAMETER
           
static int CROSSHAIR
           
static int DOUBLE_CLICK_THRESHOLD
           
static int DROPPER
           
static int ELLIPSE_ROI
           
static int FREELINE
           
static int FREEROI
           
static int HAND
           
static boolean isBackgroundColor
           
static boolean isForegroundColor
           
static int LASTSPARE
           
static int LINE
           
static int MAGNIFIER
           
static int NUM_COLUMN_BUTTONS
           
static int OVAL
           
static int OVAL_ROI
           
static int POINT
           
static int POLYGON
           
static int POLYLINE
           
static int RECTANGLE
           
static int SPARE1
           
static int SPARE10
           
static int SPARE11
           
static int SPARE12
           
static int SPARE13
           
static int SPARE14
           
static int SPARE15
           
static int SPARE16
           
static int SPARE17
           
static int SPARE18
           
static int SPARE2
           
static int SPARE3
           
static int SPARE4
           
static int SPARE5
           
static int SPARE6
           
static int SPARE7
           
static int SPARE8
           
static int SPARE9
           
static int TEXT
           
static int WAND
           
 
Fields inherited from class javax.swing.JComponent
accessibleContext, listenerList, TOOL_TIP_TEXT_KEY, ui, UNDEFINED_CONDITION, WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, WHEN_FOCUSED, WHEN_IN_FOCUSED_WINDOW
 
Fields inherited from class java.awt.Component
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
Toolbar()
           
 
Method Summary
 void actionPerformed(java.awt.event.ActionEvent e)
           
 void addMacroTool(java.lang.String name, MacroInstaller macroInstaller, int id)
          Used by the MacroInstaller class to install macro tools.
 int addTool(java.lang.String toolTip)
          Adds a tool to the toolbar.
 void drowTools(int tool, int tx, int ty)
           
static java.awt.Color getBackgroundColor()
           
static int getBrushSize()
          Returns the size of the brush tool, or 0 if the brush tool is not enabled.
static int getButtonSize()
           
 java.awt.Color getColor()
          Deprecated. replaced by getForegroundColor()
 int getColumnIndex(int index)
           
static java.awt.Color getForegroundColor()
           
static Toolbar getInstance()
          Returns a reference to the ImageJ toolbar.
 java.awt.Dimension getMinimumSize()
           
static boolean getMultiPointMode()
          Returns 'true' if the multi-point tool is enabled.
static int getOvalToolType()
          Returns the oval tool type (OVAL_ROI, ELLIPSE_ROI or BRUSH_ROI).
 java.awt.Dimension getPreferredSize()
           
static int getRoundRectArcSize()
          Returns the rounded rectangle arc size, or 0 if the rounded rectangle tool is not enabled.
 int getRowIndex(int index)
           
static int getToolId()
          Returns the ID of the current tool (Toolbar.RECTANGLE, Toolbar.OVAL, etc.).
 int getToolId(java.lang.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.
static java.lang.String getToolName()
          Returns the name of the current tool.
 void itemStateChanged(java.awt.event.ItemEvent e)
           
 void mouseClicked(java.awt.event.MouseEvent e)
           
 void mouseDragged(java.awt.event.MouseEvent e)
           
 void mouseEntered(java.awt.event.MouseEvent e)
           
 void mouseExited(java.awt.event.MouseEvent e)
           
 void mouseMoved(java.awt.event.MouseEvent e)
           
 void mousePressed(java.awt.event.MouseEvent e)
           
 void mouseReleased(java.awt.event.MouseEvent e)
           
 void paintComponent(java.awt.Graphics g)
           
 void propertyChange(java.beans.PropertyChangeEvent e)
           
 void restorePreviousTool()
           
static void setBackgroundColor(java.awt.Color c)
           
static void setBrushSize(int size)
          Set the size of the brush tool, which must be greater than 4.
 void setColor(java.awt.Color c)
          Deprecated. replaced by setForegroundColor()
static void setForegroundColor(java.awt.Color c)
           
static void setRoiColor(java.awt.Color c)
           
static void setRoundRectArcSize(int size)
          Sets the rounded rectangle corner diameter (pixels).
 void setTool(int tool)
           
 boolean setTool(java.lang.String name)
           
 void setToolbarDim(int rowNum)
           
 void update(java.awt.Graphics g)
           
 
Methods inherited from class javax.swing.JComponent
addAncestorListener, addNotify, addVetoableChangeListener, computeVisibleRect, contains, createToolTip, disable, enable, firePropertyChange, firePropertyChange, firePropertyChange, fireVetoableChange, getAccessibleContext, getActionForKeyStroke, getActionMap, getAlignmentX, getAlignmentY, getAncestorListeners, getAutoscrolls, getBaseline, getBaselineResizeBehavior, getBorder, getBounds, getClientProperty, getComponentGraphics, getComponentPopupMenu, getConditionForKeyStroke, getDebugGraphicsOptions, getDefaultLocale, getFontMetrics, getGraphics, getHeight, getInheritsPopupMenu, getInputMap, getInputMap, getInputVerifier, getInsets, getInsets, getListeners, getLocation, getMaximumSize, getNextFocusableComponent, getPopupLocation, getRegisteredKeyStrokes, getRootPane, getSize, getToolTipLocation, getToolTipText, getToolTipText, getTopLevelAncestor, getTransferHandler, getUIClassID, getVerifyInputWhenFocusTarget, getVetoableChangeListeners, getVisibleRect, getWidth, getX, getY, grabFocus, isDoubleBuffered, isLightweightComponent, isManagingFocus, isOpaque, isOptimizedDrawingEnabled, isPaintingForPrint, isPaintingTile, isRequestFocusEnabled, isValidateRoot, paint, paintBorder, paintChildren, paintImmediately, paintImmediately, paramString, print, printAll, printBorder, printChildren, printComponent, processComponentKeyEvent, processKeyBinding, processKeyEvent, processMouseEvent, processMouseMotionEvent, putClientProperty, registerKeyboardAction, registerKeyboardAction, removeAncestorListener, removeNotify, removeVetoableChangeListener, repaint, repaint, requestDefaultFocus, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, resetKeyboardActions, reshape, revalidate, scrollRectToVisible, setActionMap, setAlignmentX, setAlignmentY, setAutoscrolls, setBackground, setBorder, setComponentPopupMenu, setDebugGraphicsOptions, setDefaultLocale, setDoubleBuffered, setEnabled, setFocusTraversalKeys, setFont, setForeground, setInheritsPopupMenu, setInputMap, setInputVerifier, setMaximumSize, setMinimumSize, setNextFocusableComponent, setOpaque, setPreferredSize, setRequestFocusEnabled, setToolTipText, setTransferHandler, setUI, setVerifyInputWhenFocusTarget, setVisible, unregisterKeyboardAction, updateUI
 
Methods inherited from class java.awt.Container
add, add, add, add, add, addContainerListener, addImpl, addPropertyChangeListener, addPropertyChangeListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getComponentZOrder, getContainerListeners, getFocusTraversalKeys, getFocusTraversalPolicy, getLayout, getMousePosition, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusCycleRoot, isFocusTraversalPolicyProvider, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, preferredSize, printComponents, processContainerEvent, processEvent, remove, remove, removeAll, removeContainerListener, setComponentZOrder, setFocusCycleRoot, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, setLayout, transferFocusBackward, transferFocusDownCycle, validate, validateTree
 
Methods inherited from class java.awt.Component
action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, bounds, checkImage, checkImage, coalesceEvents, contains, createImage, createImage, createVolatileImage, createVolatileImage, disableEvents, dispatchEvent, enable, enableEvents, enableInputMethods, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getBackground, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusCycleRootAncestor, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getForeground, getGraphicsConfiguration, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputContext, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocale, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMousePosition, getMouseWheelListeners, getName, getParent, getPeer, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getToolkit, getTreeLock, gotFocus, handleEvent, hasFocus, hide, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isMaximumSizeSet, isMinimumSizeSet, isPreferredSizeSet, isShowing, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, postEvent, prepareImage, prepareImage, processComponentEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processMouseWheelEvent, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, resize, resize, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setFocusable, setFocusTraversalKeysEnabled, setIgnoreRepaint, setLocale, setLocation, setLocation, setName, setSize, setSize, show, show, size, toString, transferFocus, transferFocusUpCycle
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

RECTANGLE

public static final int RECTANGLE
See Also:
Constant Field Values

OVAL

public static final int OVAL
See Also:
Constant Field Values

POLYGON

public static final int POLYGON
See Also:
Constant Field Values

FREEROI

public static final int FREEROI
See Also:
Constant Field Values

LINE

public static final int LINE
See Also:
Constant Field Values

POLYLINE

public static final int POLYLINE
See Also:
Constant Field Values

FREELINE

public static final int FREELINE
See Also:
Constant Field Values

POINT

public static final int POINT
See Also:
Constant Field Values

CROSSHAIR

public static final int CROSSHAIR
See Also:
Constant Field Values

WAND

public static final int WAND
See Also:
Constant Field Values

TEXT

public static final int TEXT
See Also:
Constant Field Values

SPARE1

public static final int SPARE1
See Also:
Constant Field Values

MAGNIFIER

public static final int MAGNIFIER
See Also:
Constant Field Values

HAND

public static final int HAND
See Also:
Constant Field Values

DROPPER

public static final int DROPPER
See Also:
Constant Field Values

ANGLE

public static final int ANGLE
See Also:
Constant Field Values

SPARE2

public static final int SPARE2
See Also:
Constant Field Values

SPARE3

public static final int SPARE3
See Also:
Constant Field Values

SPARE4

public static final int SPARE4
See Also:
Constant Field Values

SPARE5

public static final int SPARE5
See Also:
Constant Field Values

SPARE6

public static final int SPARE6
See Also:
Constant Field Values

SPARE7

public static final int SPARE7
See Also:
Constant Field Values

SPARE8

public static final int SPARE8
See Also:
Constant Field Values

SPARE9

public static final int SPARE9
See Also:
Constant Field Values

SPARE10

public static final int SPARE10
See Also:
Constant Field Values

SPARE11

public static final int SPARE11
See Also:
Constant Field Values

SPARE12

public static final int SPARE12
See Also:
Constant Field Values

SPARE13

public static final int SPARE13
See Also:
Constant Field Values

SPARE14

public static final int SPARE14
See Also:
Constant Field Values

SPARE15

public static final int SPARE15
See Also:
Constant Field Values

SPARE16

public static final int SPARE16
See Also:
Constant Field Values

SPARE17

public static final int SPARE17
See Also:
Constant Field Values

SPARE18

public static final int SPARE18
See Also:
Constant Field Values

DOUBLE_CLICK_THRESHOLD

public static final int DOUBLE_CLICK_THRESHOLD
See Also:
Constant Field Values

OVAL_ROI

public static final int OVAL_ROI
See Also:
Constant Field Values

ELLIPSE_ROI

public static final int ELLIPSE_ROI
See Also:
Constant Field Values

BRUSH_ROI

public static final int BRUSH_ROI
See Also:
Constant Field Values

LASTSPARE

public static int LASTSPARE

NUM_COLUMN_BUTTONS

public static int NUM_COLUMN_BUTTONS

CORNER_DIAMETER

public static final java.lang.String CORNER_DIAMETER
See Also:
Constant Field Values

isBackgroundColor

public static boolean isBackgroundColor

isForegroundColor

public static boolean isForegroundColor
Constructor Detail

Toolbar

public Toolbar()
Method Detail

getToolId

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


getToolId

public int getToolId(java.lang.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.


getColumnIndex

public int getColumnIndex(int index)

getRowIndex

public int getRowIndex(int index)

drowTools

public void drowTools(int tool,
                      int tx,
                      int ty)

update

public void update(java.awt.Graphics g)
Overrides:
update in class javax.swing.JComponent

paintComponent

public void paintComponent(java.awt.Graphics g)
Overrides:
paintComponent in class javax.swing.JComponent

setTool

public boolean setTool(java.lang.String name)

getToolName

public static java.lang.String getToolName()
Returns the name of the current tool.


setTool

public void setTool(int tool)

getColor

public java.awt.Color getColor()
Deprecated. replaced by getForegroundColor()


setColor

public void setColor(java.awt.Color c)
Deprecated. replaced by setForegroundColor()


getForegroundColor

public static java.awt.Color getForegroundColor()

setForegroundColor

public static void setForegroundColor(java.awt.Color c)

getBackgroundColor

public static java.awt.Color getBackgroundColor()

setBackgroundColor

public static void setBackgroundColor(java.awt.Color c)

setRoiColor

public static void setRoiColor(java.awt.Color c)

getBrushSize

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


setBrushSize

public static void setBrushSize(int size)
Set the size of the brush tool, which must be greater than 4.


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(java.awt.event.MouseEvent e)
Specified by:
mousePressed in interface java.awt.event.MouseListener

restorePreviousTool

public void restorePreviousTool()

mouseReleased

public void mouseReleased(java.awt.event.MouseEvent e)
Specified by:
mouseReleased in interface java.awt.event.MouseListener

mouseExited

public void mouseExited(java.awt.event.MouseEvent e)
Specified by:
mouseExited in interface java.awt.event.MouseListener

mouseClicked

public void mouseClicked(java.awt.event.MouseEvent e)
Specified by:
mouseClicked in interface java.awt.event.MouseListener

mouseEntered

public void mouseEntered(java.awt.event.MouseEvent e)
Specified by:
mouseEntered in interface java.awt.event.MouseListener

mouseDragged

public void mouseDragged(java.awt.event.MouseEvent e)
Specified by:
mouseDragged in interface java.awt.event.MouseMotionListener

itemStateChanged

public void itemStateChanged(java.awt.event.ItemEvent e)
Specified by:
itemStateChanged in interface java.awt.event.ItemListener

propertyChange

public void propertyChange(java.beans.PropertyChangeEvent e)
Specified by:
propertyChange in interface java.beans.PropertyChangeListener

actionPerformed

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

getPreferredSize

public java.awt.Dimension getPreferredSize()
Overrides:
getPreferredSize in class javax.swing.JComponent

getMinimumSize

public java.awt.Dimension getMinimumSize()
Overrides:
getMinimumSize in class javax.swing.JComponent

mouseMoved

public void mouseMoved(java.awt.event.MouseEvent e)
Specified by:
mouseMoved in interface java.awt.event.MouseMotionListener

addTool

public int addTool(java.lang.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 tools are in use.


addMacroTool

public void addMacroTool(java.lang.String name,
                         MacroInstaller macroInstaller,
                         int id)
Used by the MacroInstaller class to install macro tools.


setToolbarDim

public void setToolbarDim(int rowNum)