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 enumEnumerates the available values for the location order kind.Nested classes/interfaces inherited from class javax.swing.JComponent
JComponent.AccessibleJComponentNested classes/interfaces inherited from class java.awt.Container
Container.AccessibleAWTContainerNested 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.ActionHandlerAction handler for the button.protected StringKey tip for the action area.protected ActionButtonModelThe button action model.protected intThe dimension of the icon of the associated command button in theCommandButtonDisplayState.FIT_TO_ICONstate.protected ResizableIconAssociated disabled icon.protected CommandButtonDisplayStateCurrent display state ofthisbutton.protected StringAdditional text.protected ResizableIconAssociated icon.protected booleanIndication 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_WINDOWFields inherited from class java.awt.Component
accessibleContext, BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENTFields 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 TypeMethodDescriptionvoidAdds the specified action listener to this button.voidAdds the specified change listener to this button.voidProgrammatically perform an action "click".protected voidfireActionPerformed(ActionEvent event) Notifies all listeners that have registered interest for notification on this event type.protected voidNotifies 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.intReturns the dimension of the icon of the associated command button in theCommandButtonDisplayState.FIT_TO_ICONstate.Returns the associated disabled icon.Return the current display state ofthisbutton.Returns the extra text of this button.doubleReturns the horizontal gap scale factor for the content of this button.intReturns 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.doubleReturns the vertical gap scale factor for the content of this button.booleanisFlat()Returns indication whether this button has flat appearance.voidRemoves the specified action listener from this button.voidRemoves the specified change listener from this button.voidsetActionKeyTip(String actionKeyTip) Sets the key tip for the action area of this button.voidsetActionModel(ActionButtonModel newModel) Sets the new action model for this button.voidsetActionRichTooltip(RichTooltip richTooltip) Sets the rich tooltip for the action area of this button.voidsetDisabledIcon(ResizableIcon disabledIcon) Sets the disabled icon for this button.voidSets new display state forthisbutton.voidsetEnabled(boolean b) voidsetExtraText(String extraText) Sets the extra text for this button.voidsetFlat(boolean isFlat) Sets the flat appearance of this button.voidsetGapScaleFactor(double gapScaleFactor) Sets new gap scale factor for the content of this button.voidsetHGapScaleFactor(double hgapScaleFactor) Sets new horizontal gap scale factor for the content of this button.voidsetHorizontalAlignment(int alignment) Sets new horizontal alignment for the content of this button.voidsetIcon(ResizableIcon defaultIcon) Sets new icon for this button.voidsetLocationOrderKind(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.voidSets the new text for this button.voidsetToolTipText(String text) voidsetUI(CommandButtonUI ui) Sets the new UI delegate.voidsetVGapScaleFactor(double vgapScaleFactor) Sets new vertical gap scale factor for the content of this button.voidupdateCustomDimension(int dimension) Updates the dimension of the icon of the associated command button in theCommandButtonDisplayState.FIT_TO_ICONstate.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, updateUIMethods 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, validateTreeMethods 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 ofthisbutton. -
customDimension
protected int customDimensionThe dimension of the icon of the associated command button in theCommandButtonDisplayState.FIT_TO_ICONstate. -
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:
getUIin classJComponent- Returns:
- The UI delegate for this button.
-
setDisplayState
Sets new display state forthisbutton. Fires adisplayStateproperty 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 aniconproperty 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 ofthisbutton.- Returns:
- The current display state of
thisbutton. - 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 anextraTextproperty 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 atextproperty 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_ICONstate. Fires acustomDimensionproperty change event.- Parameters:
dimension- New dimension of the icon of the associated command button in theCommandButtonDisplayState.FIT_TO_ICONstate.- See Also:
-
getCustomDimension
public int getCustomDimension()Returns the dimension of the icon of the associated command button in theCommandButtonDisplayState.FIT_TO_ICONstate.- Returns:
- The dimension of the icon of the associated command button in the
CommandButtonDisplayState.FIT_TO_ICONstate. - See Also:
-
isFlat
public boolean isFlat()Returns indication whether this button has flat appearance.- Returns:
trueif this button has flat appearance,falseotherwise.- See Also:
-
setFlat
public void setFlat(boolean isFlat) Sets the flat appearance of this button. Fires aflatproperty 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 anactionModelproperty 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:
setEnabledin 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 theeventparameter.- Parameters:
event- theActionEventobject- See Also:
-
setHorizontalAlignment
public void setHorizontalAlignment(int alignment) Sets new horizontal alignment for the content of this button. Fires ahorizontalAlignmentproperty 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 anhgapScaleFactorproperty 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 avgapScaleFactorproperty 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:
getRichTooltipin classRichToolTipManager.JTrackableComponent
-
setToolTipText
- Overrides:
setToolTipTextin 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 alocationOrderKindproperty 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 anactionKeyTipproperty change event.- Parameters:
actionKeyTip- The key tip for the action area of this button.- See Also:
-