Class AbstractCommandButton
java.lang.Object
java.awt.Component
java.awt.Container
javax.swing.JComponent
org.pushingpixels.flamingo.api.common.RichToolTipManager.JTrackableComponent
org.pushingpixels.flamingo.api.common.AbstractCommandButton
- All Implemented Interfaces:
ImageObserver
,MenuContainer
,Serializable
- Direct Known Subclasses:
JCommandButton
,JCommandToggleButton
Base class for command buttons.
- See Also:
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic enum
Enumerates the available values for the location order kind.Nested classes/interfaces inherited from class javax.swing.JComponent
JComponent.AccessibleJComponent
Nested classes/interfaces inherited from class java.awt.Container
Container.AccessibleAWTContainer
Nested classes/interfaces inherited from class java.awt.Component
Component.AccessibleAWTComponent, Component.BaselineResizeBehavior, Component.BltBufferStrategy, Component.FlipBufferStrategy
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected org.pushingpixels.flamingo.api.common.AbstractCommandButton.ActionHandler
Action handler for the button.protected String
Key tip for the action area.protected ActionButtonModel
The button action model.protected int
The dimension of the icon of the associated command button in theCommandButtonDisplayState.FIT_TO_ICON
state.protected ResizableIcon
Associated disabled icon.protected CommandButtonDisplayState
Current display state ofthis
button.protected String
Additional text.protected ResizableIcon
Associated icon.protected boolean
Indication whether this button is flat.Fields inherited from class javax.swing.JComponent
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
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
ConstructorsConstructorDescriptionAbstractCommandButton
(String text, ResizableIcon icon) Creates a new command button. -
Method Summary
Modifier and TypeMethodDescriptionvoid
Adds the specified action listener to this button.void
Adds the specified change listener to this button.void
Programmatically perform an action "click".protected void
fireActionPerformed
(ActionEvent event) Notifies all listeners that have registered interest for notification on this event type.protected void
Notifies all listeners that have registered interest for notification on this event type.Returns the key tip for the action area of this button.Returns the action model for this button.int
Returns the dimension of the icon of the associated command button in theCommandButtonDisplayState.FIT_TO_ICON
state.Returns the associated disabled icon.Return the current display state ofthis
button.Returns the extra text of this button.double
Returns the horizontal gap scale factor for the content of this button.int
Returns the horizontal alignment for the content of this button.getIcon()
Returns the associated icon.Returns the location order kind for buttons placed in command button strips or for buttons that need the visuals of segmented strips.getRichTooltip
(MouseEvent mouseEvent) getText()
Returns the text of this button.getUI()
Returns the UI delegate for this button.double
Returns the vertical gap scale factor for the content of this button.boolean
isFlat()
Returns indication whether this button has flat appearance.void
Removes the specified action listener from this button.void
Removes the specified change listener from this button.void
setActionKeyTip
(String actionKeyTip) Sets the key tip for the action area of this button.void
setActionModel
(ActionButtonModel newModel) Sets the new action model for this button.void
setActionRichTooltip
(RichTooltip richTooltip) Sets the rich tooltip for the action area of this button.void
setDisabledIcon
(ResizableIcon disabledIcon) Sets the disabled icon for this button.void
Sets new display state forthis
button.void
setEnabled
(boolean b) void
setExtraText
(String extraText) Sets the extra text for this button.void
setFlat
(boolean isFlat) Sets the flat appearance of this button.void
setGapScaleFactor
(double gapScaleFactor) Sets new gap scale factor for the content of this button.void
setHGapScaleFactor
(double hgapScaleFactor) Sets new horizontal gap scale factor for the content of this button.void
setHorizontalAlignment
(int alignment) Sets new horizontal alignment for the content of this button.void
setIcon
(ResizableIcon defaultIcon) Sets new icon for this button.void
setLocationOrderKind
(AbstractCommandButton.CommandButtonLocationOrderKind locationOrderKind) Sets the location order kind for buttons placed in command button strips or for buttons that need the visuals of segmented strips.void
Sets the new text for this button.void
setToolTipText
(String text) void
setUI
(CommandButtonUI ui) Sets the new UI delegate.void
setVGapScaleFactor
(double vgapScaleFactor) Sets new vertical gap scale factor for the content of this button.void
updateCustomDimension
(int dimension) Updates the dimension of the icon of the associated command button in theCommandButtonDisplayState.FIT_TO_ICON
state.Methods inherited from class javax.swing.JComponent
addAncestorListener, addNotify, addVetoableChangeListener, computeVisibleRect, contains, createToolTip, disable, enable, firePropertyChange, firePropertyChange, firePropertyChange, fireVetoableChange, 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, getMinimumSize, getNextFocusableComponent, getPopupLocation, getPreferredSize, getRegisteredKeyStrokes, getRootPane, getSize, getToolTipLocation, getToolTipText, getToolTipText, getTopLevelAncestor, getTransferHandler, getUIClassID, getVerifyInputWhenFocusTarget, getVetoableChangeListeners, getVisibleRect, getWidth, getX, getY, grabFocus, hide, isDoubleBuffered, isLightweightComponent, isManagingFocus, isOpaque, isOptimizedDrawingEnabled, isPaintingForPrint, isPaintingOrigin, isPaintingTile, isRequestFocusEnabled, isValidateRoot, paint, paintBorder, paintChildren, paintComponent, 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, setFocusTraversalKeys, setFont, setForeground, setInheritsPopupMenu, setInputMap, setInputVerifier, setMaximumSize, setMinimumSize, setNextFocusableComponent, setOpaque, setPreferredSize, setRequestFocusEnabled, setTransferHandler, setUI, setVerifyInputWhenFocusTarget, setVisible, unregisterKeyboardAction, update, 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, 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, getAccessibleContext, 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, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getToolkit, getTreeLock, gotFocus, handleEvent, hasFocus, 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, requestFocus, requestFocus, requestFocusInWindow, resize, resize, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setFocusable, setFocusTraversalKeysEnabled, setIgnoreRepaint, setLocale, setLocation, setLocation, setMixingCutoutShape, setName, setSize, setSize, show, show, size, toString, transferFocus, transferFocusBackward, transferFocusUpCycle
-
Field Details
-
icon
Associated icon.- See Also:
-
disabledIcon
Associated disabled icon. -
actionModel
The button action model. -
extraText
Additional text. This is shown forCommandButtonDisplayState.TILE
.- See Also:
-
displayState
Current display state ofthis
button. -
customDimension
protected int customDimensionThe dimension of the icon of the associated command button in theCommandButtonDisplayState.FIT_TO_ICON
state. -
isFlat
protected boolean isFlatIndication whether this button is flat.- See Also:
-
actionHandler
protected org.pushingpixels.flamingo.api.common.AbstractCommandButton.ActionHandler actionHandlerAction handler for the button. -
actionKeyTip
Key tip for the action area.- See Also:
-
-
Constructor Details
-
AbstractCommandButton
Creates a new command button.- Parameters:
text
- Button title. May contain any number of words.icon
- Button icon.
-
-
Method Details
-
setUI
Sets the new UI delegate.- Parameters:
ui
- New UI delegate.
-
getUI
Returns the UI delegate for this button.- Overrides:
getUI
in classJComponent
- Returns:
- The UI delegate for this button.
-
setDisplayState
Sets new display state forthis
button. Fires adisplayState
property change event.- Parameters:
state
- New display state.- See Also:
-
getIcon
Returns the associated icon.- Returns:
- The associated icon.
- See Also:
-
setIcon
Sets new icon for this button. Fires anicon
property change event.- Parameters:
defaultIcon
- New default icon for this button.- See Also:
-
setDisabledIcon
Sets the disabled icon for this button.- Parameters:
disabledIcon
- Disabled icon for this button.- See Also:
-
getDisabledIcon
Returns the associated disabled icon.- Returns:
- The associated disabled icon.
- See Also:
-
getDisplayState
Return the current display state ofthis
button.- Returns:
- The current display state of
this
button. - See Also:
-
getExtraText
Returns the extra text of this button.- Returns:
- Extra text of this button.
- See Also:
-
setExtraText
Sets the extra text for this button. Fires anextraText
property change event.- Parameters:
extraText
- Extra text for this button.- See Also:
-
getText
Returns the text of this button.- Returns:
- The text of this button.
- See Also:
-
setText
Sets the new text for this button. Fires atext
property change event.- Parameters:
text
- The new text for this button.- See Also:
-
updateCustomDimension
public void updateCustomDimension(int dimension) Updates the dimension of the icon of the associated command button in theCommandButtonDisplayState.FIT_TO_ICON
state. Fires acustomDimension
property change event.- Parameters:
dimension
- New dimension of the icon of the associated command button in theCommandButtonDisplayState.FIT_TO_ICON
state.- See Also:
-
getCustomDimension
public int getCustomDimension()Returns the dimension of the icon of the associated command button in theCommandButtonDisplayState.FIT_TO_ICON
state.- Returns:
- The dimension of the icon of the associated command button in the
CommandButtonDisplayState.FIT_TO_ICON
state. - See Also:
-
isFlat
public boolean isFlat()Returns indication whether this button has flat appearance.- Returns:
true
if this button has flat appearance,false
otherwise.- See Also:
-
setFlat
public void setFlat(boolean isFlat) Sets the flat appearance of this button. Fires aflat
property change event.- Parameters:
isFlat
- Iftrue
, this button will have flat appearance, otherwise this button will not have flat appearance.- See Also:
-
getActionModel
Returns the action model for this button.- Returns:
- The action model for this button.
- See Also:
-
setActionModel
Sets the new action model for this button. Fires anactionModel
property change event.- Parameters:
newModel
- The new action model for this button.- See Also:
-
addActionListener
Adds the specified action listener to this button.- Parameters:
l
- Action listener to add.- See Also:
-
removeActionListener
Removes the specified action listener from this button.- Parameters:
l
- Action listener to remove.- See Also:
-
addChangeListener
Adds the specified change listener to this button.- Parameters:
l
- Change listener to add.- See Also:
-
removeChangeListener
Removes the specified change listener from this button.- Parameters:
l
- Change listener to remove.- See Also:
-
setEnabled
public void setEnabled(boolean b) - Overrides:
setEnabled
in classJComponent
-
fireStateChanged
protected void fireStateChanged()Notifies all listeners that have registered interest for notification on this event type. The event instance is lazily created.- See Also:
-
fireActionPerformed
Notifies all listeners that have registered interest for notification on this event type. The event instance is lazily created using theevent
parameter.- Parameters:
event
- theActionEvent
object- See Also:
-
setHorizontalAlignment
public void setHorizontalAlignment(int alignment) Sets new horizontal alignment for the content of this button. Fires ahorizontalAlignment
property change event.- Parameters:
alignment
- New horizontal alignment for the content of this button.- See Also:
-
getHorizontalAlignment
public int getHorizontalAlignment()Returns the horizontal alignment for the content of this button.- Returns:
- The horizontal alignment for the content of this button.
- See Also:
-
setHGapScaleFactor
public void setHGapScaleFactor(double hgapScaleFactor) Sets new horizontal gap scale factor for the content of this button. Fires anhgapScaleFactor
property change event.- Parameters:
hgapScaleFactor
- New horizontal gap scale factor for the content of this button.- See Also:
-
setVGapScaleFactor
public void setVGapScaleFactor(double vgapScaleFactor) Sets new vertical gap scale factor for the content of this button. Fires avgapScaleFactor
property change event.- Parameters:
vgapScaleFactor
- New vertical gap scale factor for the content of this button.- See Also:
-
setGapScaleFactor
public void setGapScaleFactor(double gapScaleFactor) Sets new gap scale factor for the content of this button.- Parameters:
gapScaleFactor
- New gap scale factor for the content of this button.- See Also:
-
getHGapScaleFactor
public double getHGapScaleFactor()Returns the horizontal gap scale factor for the content of this button.- Returns:
- The horizontal gap scale factor for the content of this button.
- See Also:
-
getVGapScaleFactor
public double getVGapScaleFactor()Returns the vertical gap scale factor for the content of this button.- Returns:
- The vertical gap scale factor for the content of this button.
- See Also:
-
doActionClick
public void doActionClick()Programmatically perform an action "click". This does the same thing as if the user had pressed and released the action area of the button. -
setActionRichTooltip
Sets the rich tooltip for the action area of this button.- Parameters:
richTooltip
- Rich tooltip for the action area of this button.- See Also:
-
getRichTooltip
- Specified by:
getRichTooltip
in classRichToolTipManager.JTrackableComponent
-
setToolTipText
- Overrides:
setToolTipText
in classJComponent
-
getLocationOrderKind
Returns the location order kind for buttons placed in command button strips or for buttons that need the visuals of segmented strips.- Returns:
- The location order kind for buttons placed in command button strips or for buttons that need the visuals of segmented strips.
- See Also:
-
setLocationOrderKind
public void setLocationOrderKind(AbstractCommandButton.CommandButtonLocationOrderKind locationOrderKind) Sets the location order kind for buttons placed in command button strips or for buttons that need the visuals of segmented strips. Fires alocationOrderKind
property change event.- Parameters:
locationOrderKind
- The location order kind for buttons placed in command button strips or for buttons that need the visuals of segmented strips.- See Also:
-
getActionKeyTip
Returns the key tip for the action area of this button.- Returns:
- The key tip for the action area of this button.
- See Also:
-
setActionKeyTip
Sets the key tip for the action area of this button. Fires anactionKeyTip
property change event.- Parameters:
actionKeyTip
- The key tip for the action area of this button.- See Also:
-