ij.gui
Class Toolbar

java.lang.Object
  extended by java.awt.Component
      extended by java.awt.Canvas
          extended by ij.gui.Toolbar
All Implemented Interfaces:
java.awt.event.MouseListener, java.awt.event.MouseMotionListener, java.awt.image.ImageObserver, java.awt.MenuContainer, java.io.Serializable, java.util.EventListener, javax.accessibility.Accessible

public class Toolbar
extends java.awt.Canvas
implements java.awt.event.MouseListener, java.awt.event.MouseMotionListener

The ImageJ toolbar.

See Also:
Serialized Form

Nested Class Summary
 
Nested classes/interfaces inherited from class java.awt.Canvas
java.awt.Canvas.AccessibleAWTCanvas
 
Nested classes/interfaces inherited from class java.awt.Component
java.awt.Component.AccessibleAWTComponent, java.awt.Component.BltBufferStrategy, java.awt.Component.FlipBufferStrategy
 
Field Summary
static int ANGLE
           
static int CROSSHAIR
           
static int DOUBLE_CLICK_THRESHOLD
           
static int DROPPER
           
static int FREELINE
           
static int FREEROI
           
static int HAND
           
static int LINE
           
static int MAGNIFIER
           
static int OVAL
           
static int POINT
           
static int POLYGON
           
static int POLYLINE
           
static int RECTANGLE
           
static int SPARE1
           
static int SPARE2
           
static int SPARE3
           
static int SPARE4
           
static int SPARE5
           
static int SPARE6
           
static int SPARE7
           
static int TEXT
           
static int WAND
           
 
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 addMacroTool(java.lang.String name, MacroInstaller macroInstaller, int id)
          Used by the MacroInstaller class to install macro tools.
 int addTool(java.lang.String toolTip)
          Enables the unused tool between the text and zoom tools.
static java.awt.Color getBackgroundColor()
           
 java.awt.Color getColor()
          Obsolete.
static java.awt.Color getForegroundColor()
           
static Toolbar getInstance()
          Returns a reference to the ImageJ toolbar.
 java.awt.Dimension getMinimumSize()
           
 java.awt.Dimension getPreferredSize()
           
static int getToolId()
          Returns the ID of the current tool (Toolbar.RECTANGLE, Toolbar.OVAL, etc.).
 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 paint(java.awt.Graphics g)
           
 void restorePreviousTool()
           
static void setBackgroundColor(java.awt.Color c)
           
 void setColor(java.awt.Color c)
          Obsolete.
static void setForegroundColor(java.awt.Color c)
           
 void setTool(int tool)
           
 
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, 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, getPeer, 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, requestFocusInWindow, requestFocusInWindow, reshape, resize, resize, setBackground, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setEnabled, setFocusable, setFocusTraversalKeys, setFocusTraversalKeysEnabled, setFont, setForeground, setIgnoreRepaint, setLocale, setLocation, setLocation, setMaximumSize, setMinimumSize, setName, setPreferredSize, setSize, setSize, setVisible, show, show, size, toString, transferFocus, transferFocusBackward, transferFocusUpCycle, validate
 
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

DOUBLE_CLICK_THRESHOLD

public static final int DOUBLE_CLICK_THRESHOLD
See Also:
Constant Field Values
Constructor Detail

Toolbar

public Toolbar()
Method Detail

getToolId

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


getInstance

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


paint

public void paint(java.awt.Graphics g)
Overrides:
paint in class java.awt.Canvas

setTool

public void setTool(int tool)

getColor

public java.awt.Color getColor()
Obsolete. Use getForegroundColor().


setColor

public void setColor(java.awt.Color c)
Obsolete. Use 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)

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

getPreferredSize

public java.awt.Dimension getPreferredSize()
Overrides:
getPreferredSize in class java.awt.Component

getMinimumSize

public java.awt.Dimension getMinimumSize()
Overrides:
getMinimumSize in class java.awt.Component

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)
Enables the unused tool between the text and zoom tools. The 'toolTip' string is displayed in the status bar when the user clicks on the tool. If the 'toolTip' string includes an icon (see Tools.txt macro), enables the next available tool and draws it using that icon. 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.