com.borland.primetime.actions
Class ActionButton
java.lang.Object
|
+--java.awt.Component
|
+--java.awt.Container
|
+--javax.swing.JComponent
|
+--com.borland.primetime.actions.ActionButton
- All Implemented Interfaces:
- ActionWidget, java.awt.image.ImageObserver, java.awt.MenuContainer, java.io.Serializable
- public class ActionButton
- extends javax.swing.JComponent
- implements ActionWidget
The ActionButton is a UI widget that represents a single Action object.
ActionButtons represent Action objects by showing their small icon, short
text in a tooltip, and mirroring their enabled state. When an ActionButton
is clicked, it calls its associated Action's actionPerformed method.
ActionButtons are constructed with a source Object and an Action to
represent. The source Object will be passed as the source of the ActionEvent
to the assoicated Action's actionPerformed method. This allows an
ActionButton to pass a particular source object (not the button itself), so
the associated Actions can have direct access to a specific Object. This
source is determined by the code that instantiates the ActionButton.
ActionButtons that are associated with UpdateableActions will add
themselves to a timer that automatically updates the state of the action at
regular intervals.
ActionButtons also have special functionality to represent StateAction
objects - they will appear depressed when the StateAction's state property
is 'true' and flat when it is 'false'.
- See Also:
Action
,
UpdateableAction
,
StateAction
, Serialized Form
Inner classes inherited from class javax.swing.JComponent |
javax.swing.JComponent.AccessibleJComponent |
Inner classes inherited from class java.awt.Container |
java.awt.Container.AccessibleAWTContainer |
Inner classes inherited from class java.awt.Component |
java.awt.Component.AccessibleAWTComponent |
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 |
ActionButton(java.lang.Object source,
javax.swing.Action action)
Constructs an ActionButton with the specified source and action objects. |
ActionButton(java.lang.Object source,
javax.swing.Action action,
java.awt.Dimension fixedSize)
Constructs an ActionButton with the specified source and action objects,
using the specified button size. |
ActionButton(java.lang.Object source,
javax.swing.Action action,
java.awt.Dimension fixedSize,
boolean useSmallIcon)
Constructs an ActionButton with the specified source and action objects,
using the specified button size, and the useSmallIcon setting. |
Methods inherited from class javax.swing.JComponent |
addAncestorListener, addPropertyChangeListener, addPropertyChangeListener, addVetoableChangeListener, computeVisibleRect, contains, disable, enable, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, fireVetoableChange, getAccessibleContext, getActionForKeyStroke, getActionMap, getAlignmentX, getAlignmentY, getAutoscrolls, getBorder, getBounds, getClientProperty, getComponentGraphics, getConditionForKeyStroke, getDebugGraphicsOptions, getGraphics, getHeight, getInputMap, getInputMap, getInputVerifier, getInsets, getInsets, getListeners, getLocation, getMaximumSize, getMinimumSize, getNextFocusableComponent, getRegisteredKeyStrokes, getRootPane, getSize, getToolTipLocation, getToolTipText, getToolTipText, getTopLevelAncestor, getUIClassID, getVerifyInputWhenFocusTarget, getVisibleRect, getWidth, getX, getY, grabFocus, hasFocus, hide, isDoubleBuffered, isFocusCycleRoot, isLightweightComponent, isManagingFocus, isMaximumSizeSet, isMinimumSizeSet, isOpaque, isOptimizedDrawingEnabled, isPaintingTile, isPreferredSizeSet, isRequestFocusEnabled, isValidateRoot, paint, paintBorder, paintImmediately, paintImmediately, paramString, print, printAll, printBorder, printChildren, printComponent, processComponentKeyEvent, processFocusEvent, processKeyBinding, processKeyEvent, processMouseMotionEvent, putClientProperty, registerKeyboardAction, registerKeyboardAction, removeAncestorListener, removePropertyChangeListener, removePropertyChangeListener, removeVetoableChangeListener, repaint, repaint, requestDefaultFocus, requestFocus, resetKeyboardActions, reshape, revalidate, scrollRectToVisible, setActionMap, setAlignmentX, setAlignmentY, setAutoscrolls, setBackground, setBorder, setDebugGraphicsOptions, setDoubleBuffered, setEnabled, setFont, setForeground, setInputMap, setInputVerifier, setMaximumSize, setMinimumSize, setNextFocusableComponent, setOpaque, setPreferredSize, setRequestFocusEnabled, setUI, setVerifyInputWhenFocusTarget, setVisible, unregisterKeyboardAction, update, updateUI |
Methods inherited from class java.awt.Container |
add, add, add, add, add, addContainerListener, addImpl, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getLayout, insets, invalidate, isAncestorOf, layout, list, list, locate, minimumSize, paintComponents, preferredSize, printComponents, processContainerEvent, processEvent, remove, remove, removeAll, removeContainerListener, setLayout, validate, validateTree |
Methods inherited from class java.awt.Component |
action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, bounds, checkImage, checkImage, coalesceEvents, contains, createImage, createImage, disableEvents, dispatchEvent, enable, enableEvents, enableInputMethods, getBackground, getBounds, getColorModel, getComponentOrientation, getCursor, getDropTarget, getFont, getFontMetrics, getForeground, getGraphicsConfiguration, getInputContext, getInputMethodRequests, getLocale, getLocation, getLocationOnScreen, getName, getParent, getPeer, getSize, getToolkit, getTreeLock, gotFocus, handleEvent, imageUpdate, inside, isDisplayable, isEnabled, isLightweight, isShowing, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, postEvent, prepareImage, prepareImage, processComponentEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, repaint, repaint, repaint, resize, resize, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setLocale, setLocation, setLocation, setName, setSize, setSize, show, show, size, toString, transferFocus |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
UP
protected static final int UP
FLAT
protected static final int FLAT
DOWN
protected static final int DOWN
globalMouseDown
protected static boolean globalMouseDown
globalPopping
protected static boolean globalPopping
icon_marker
protected static javax.swing.Icon icon_marker
fixedWidth
protected int fixedWidth
fixedHeight
protected int fixedHeight
popWidth
protected int popWidth
ae
protected java.awt.event.ActionEvent ae
source
protected java.lang.Object source
action
protected javax.swing.Action action
useSmallIcon
protected boolean useSmallIcon
icon
protected javax.swing.Icon icon
icon_dis
protected javax.swing.Icon icon_dis
icon_roll
protected javax.swing.Icon icon_roll
gapSize
protected int gapSize
shortText
protected java.lang.String shortText
altShortText
protected java.lang.String altShortText
longText
protected java.lang.String longText
rollover
protected boolean rollover
mouseDown
protected boolean mouseDown
popping
protected boolean popping
showIcon
protected boolean showIcon
showText
protected boolean showText
showRips
protected boolean showRips
center
protected boolean center
glowStyle
protected boolean glowStyle
dither
protected java.awt.Image dither
pcl
protected java.beans.PropertyChangeListener pcl
ActionButton
public ActionButton(java.lang.Object source,
javax.swing.Action action)
- Constructs an ActionButton with the specified source and action objects.
- Parameters:
source
- The source objectaction
- The action object
ActionButton
public ActionButton(java.lang.Object source,
javax.swing.Action action,
java.awt.Dimension fixedSize)
- Constructs an ActionButton with the specified source and action objects,
using the specified button size.
ActionButton
public ActionButton(java.lang.Object source,
javax.swing.Action action,
java.awt.Dimension fixedSize,
boolean useSmallIcon)
- Constructs an ActionButton with the specified source and action objects,
using the specified button size, and the useSmallIcon setting.
clear
public void clear()
setFixedSize
public void setFixedSize(java.awt.Dimension d)
- Sets the button size.
- Parameters:
d
- The new button size
getFixedSize
public java.awt.Dimension getFixedSize()
- Returns the button size.
- Returns:
- The button size
setFixedWidth
public void setFixedWidth(int width)
getFixedWidth
public int getFixedWidth()
setFixedHeight
public void setFixedHeight(int height)
getFixedHeight
public int getFixedHeight()
setGapSize
public void setGapSize(int gap)
getGapSize
public int getGapSize()
setShowIcon
public void setShowIcon(boolean showIcon)
isShowIcon
public boolean isShowIcon()
setShowText
public void setShowText(boolean showText)
isShowText
public boolean isShowText()
setShowRips
public void setShowRips(boolean rips)
isShowRips
public boolean isShowRips()
setCentered
public void setCentered(boolean center)
isCentered
public boolean isCentered()
setGlowStyle
public void setGlowStyle(boolean glow)
- Sets the glowStyle property. When the glowStyle is set to true, the
icons will glow as the mouse moves over them. When the glowStyle is set
to false, the ActionButtons pop up as the mouse moves over them. By
default, the glow style is false.
- Parameters:
glow
- The glow style stetting for this ActionButton
isGlowStyle
public boolean isGlowStyle()
- Returns the glowStyle property setting.
- Returns:
- The glow style stetting for all ActionButtons
setUseSmallIcon
public void setUseSmallIcon(boolean useSmall)
- Sets the useSmallIcon property. When set to true (default), the SMALL_ICON
value will be used on the ActionButton. When set to false, the LARGE_ICON
value is used.
- Parameters:
useSmall
- The useSmallIcon property setting
isUseSmallIcon
public boolean isUseSmallIcon()
- Returns the useSmallIcon property setting.
- Returns:
- The useSmallIcon property setting
setIcon
public void setIcon(javax.swing.Icon i)
- Sets the icon for the ActionButton. When an icon is set, a few other
icons are auto-generated, including a disabled version, and possibly a
rollover version if the 'glowStyle' property is set.
- Parameters:
i
- The icon for the ActionButton
getSource
public java.lang.Object getSource()
- Returns the object source for this ActionButton.
- Specified by:
getSource
in interface ActionWidget
- Returns:
- The source object
getAction
public javax.swing.Action getAction()
- Returns the Action for this ActionButton.
- Specified by:
getAction
in interface ActionWidget
- Returns:
- The Action
getPreferredSize
public java.awt.Dimension getPreferredSize()
- Overrides:
getPreferredSize
in class javax.swing.JComponent
isFocusTraversable
public boolean isFocusTraversable()
- Overrides:
isFocusTraversable
in class javax.swing.JComponent
setToolTipText
public void setToolTipText(java.lang.String text)
- Overrides:
setToolTipText
in class javax.swing.JComponent
setLongText
protected void setLongText(java.lang.String longText)
setShortText
protected void setShortText(java.lang.String shortText)
setAltShortText
protected void setAltShortText(java.lang.String altShortText)
addNotify
public void addNotify()
- Overrides:
addNotify
in class javax.swing.JComponent
removeNotify
public void removeNotify()
- Overrides:
removeNotify
in class javax.swing.JComponent
createToolTip
public javax.swing.JToolTip createToolTip()
- Overrides:
createToolTip
in class javax.swing.JComponent
initButton
protected void initButton()
fire
protected void fire()
processMouseEvent
protected void processMouseEvent(java.awt.event.MouseEvent e)
- Overrides:
processMouseEvent
in class java.awt.Component
hasPopBar
protected boolean hasPopBar()
buttonPopState
protected int buttonPopState()
popPopState
protected int popPopState()
theIcon
protected javax.swing.Icon theIcon()
paintComponent
public void paintComponent(java.awt.Graphics g)
- Overrides:
paintComponent
in class javax.swing.JComponent
drawPopArrow
public void drawPopArrow(java.awt.Graphics g,
java.awt.Rectangle r)
drawBorder
public void drawBorder(java.awt.Graphics g,
java.awt.Rectangle r,
boolean up)
paintChildren
public void paintChildren(java.awt.Graphics g)
- Overrides:
paintChildren
in class javax.swing.JComponent