com.jgoodies.uif.component
Class UIFRadioButtonMenuItem
java.lang.Object
java.awt.Component
java.awt.Container
javax.swing.JComponent
javax.swing.AbstractButton
javax.swing.JMenuItem
javax.swing.JRadioButtonMenuItem
com.jgoodies.uif.component.UIFRadioButtonMenuItem
- All Implemented Interfaces:
- ImageObserver, ItemSelectable, MenuContainer, Serializable, Accessible, MenuElement, SwingConstants
public final class UIFRadioButtonMenuItem
- extends JRadioButtonMenuItem
A JRadioButtonMenuItem
subclass that adds supports for
temporarily invisible icons. Useful to hide icons on a specific platform or
for a specific look&feel. For example the Mac Aqua style guide
recommend to hide icons unless there's a special context such as
a history menu.
The menu item's icon set can be made visible or invisible directly.
But typically you should set the icon visible mode and use a
Mode
that describes when to
- Version:
- $Revision: 1.6 $
- Author:
- Karsten Lentzsch
- See Also:
Mode
,
Modes
,
Serialized Form
Fields inherited from class javax.swing.AbstractButton |
actionListener, BORDER_PAINTED_CHANGED_PROPERTY, changeEvent, changeListener, CONTENT_AREA_FILLED_CHANGED_PROPERTY, DISABLED_ICON_CHANGED_PROPERTY, DISABLED_SELECTED_ICON_CHANGED_PROPERTY, FOCUS_PAINTED_CHANGED_PROPERTY, HORIZONTAL_ALIGNMENT_CHANGED_PROPERTY, HORIZONTAL_TEXT_POSITION_CHANGED_PROPERTY, ICON_CHANGED_PROPERTY, itemListener, MARGIN_CHANGED_PROPERTY, MNEMONIC_CHANGED_PROPERTY, model, MODEL_CHANGED_PROPERTY, PRESSED_ICON_CHANGED_PROPERTY, ROLLOVER_ENABLED_CHANGED_PROPERTY, ROLLOVER_ICON_CHANGED_PROPERTY, ROLLOVER_SELECTED_ICON_CHANGED_PROPERTY, SELECTED_ICON_CHANGED_PROPERTY, TEXT_CHANGED_PROPERTY, VERTICAL_ALIGNMENT_CHANGED_PROPERTY, VERTICAL_TEXT_POSITION_CHANGED_PROPERTY |
Fields inherited from interface javax.swing.SwingConstants |
BOTTOM, CENTER, EAST, HORIZONTAL, LEADING, LEFT, NEXT, NORTH, NORTH_EAST, NORTH_WEST, PREVIOUS, RIGHT, SOUTH, SOUTH_EAST, SOUTH_WEST, TOP, TRAILING, VERTICAL, WEST |
Constructor Summary |
UIFRadioButtonMenuItem()
Constructs a menu item with no set text or icon. |
UIFRadioButtonMenuItem(Action action)
Constructs a radio button menu item whose properties are taken
from the specified Action . |
UIFRadioButtonMenuItem(Icon icon)
Constructs a menu item with the specified icon. |
UIFRadioButtonMenuItem(Icon icon,
boolean selected)
Constructs a menu item with the specified icon. |
UIFRadioButtonMenuItem(String text)
Constructs a menu item with the specified text. |
UIFRadioButtonMenuItem(String text,
boolean selected)
Constructs a radio button menu item with the specified text
and selection state. |
UIFRadioButtonMenuItem(String text,
Icon icon)
Constructs a menu item with the specified text and icon. |
UIFRadioButtonMenuItem(String text,
Icon icon,
boolean selected)
Constructs a radio button menu item that has the specified
text, image, and selection state. |
UIFRadioButtonMenuItem(String text,
Icon icon,
int mnemonic)
Constructs a menu item with the specified text, icon and
keyboard mnemonic. |
UIFRadioButtonMenuItem(String text,
Icon icon,
int mnemonic,
boolean selected)
Constructs a menu item with the specified text, icon and
keyboard mnemonic. |
UIFRadioButtonMenuItem(String text,
int mnemonic)
Constructs a menu item with the specified text and
keyboard mnemonic. |
UIFRadioButtonMenuItem(String text,
int mnemonic,
boolean selected)
Constructs a menu item with the specified text and
keyboard mnemonic. |
UIFRadioButtonMenuItem(ToggleAction toggleAction)
Constructs a radio button menu item whose properties are taken
from the specified ToggleAction . |
Method Summary |
protected void |
configurePropertiesFromAction(Action a)
In addition to the superclass behavior, this class
sets the displayed mnemonic index if and only if the
action provides one under key "mnemonicIndex" . |
Mode |
getIconVisibleMode()
Returns the current icon mode that determines
whether this item shows or hides an icon - if any. |
boolean |
isIconVisible()
Answers whether icons are currently visible or hidden. |
void |
setIconVisible(boolean newVisible)
Shows or hides this item's icons. |
void |
setIconVisibleMode(Mode newMode)
Sets a new icon visible mode that determines whether
this item shows or hides an icon - if any. |
void |
updateUI()
In addition to the superclass behavior that updates the UI
this method adds or removes the item's icon according to the
icon visible mode's current enabled value - if any. |
Methods inherited from class javax.swing.JMenuItem |
actionPropertyChanged, addMenuDragMouseListener, addMenuKeyListener, fireMenuDragMouseDragged, fireMenuDragMouseEntered, fireMenuDragMouseExited, fireMenuDragMouseReleased, fireMenuKeyPressed, fireMenuKeyReleased, fireMenuKeyTyped, getAccelerator, getComponent, getMenuDragMouseListeners, getMenuKeyListeners, getSubElements, init, isArmed, menuSelectionChanged, processKeyEvent, processMenuDragMouseEvent, processMenuKeyEvent, processMouseEvent, removeMenuDragMouseListener, removeMenuKeyListener, setAccelerator, setArmed, setEnabled, setModel, setUI |
Methods inherited from class javax.swing.AbstractButton |
addActionListener, addChangeListener, addImpl, addItemListener, checkHorizontalKey, checkVerticalKey, createActionListener, createActionPropertyChangeListener, createChangeListener, createItemListener, doClick, doClick, fireActionPerformed, fireItemStateChanged, fireStateChanged, getAction, getActionCommand, getActionListeners, getChangeListeners, getDisabledIcon, getDisabledSelectedIcon, getDisplayedMnemonicIndex, getHideActionText, getHorizontalAlignment, getHorizontalTextPosition, getIcon, getIconTextGap, getItemListeners, getLabel, getMargin, getMnemonic, getModel, getMultiClickThreshhold, getPressedIcon, getRolloverIcon, getRolloverSelectedIcon, getSelectedIcon, getSelectedObjects, getText, getUI, getVerticalAlignment, getVerticalTextPosition, imageUpdate, isBorderPainted, isContentAreaFilled, isFocusPainted, isRolloverEnabled, isSelected, paintBorder, removeActionListener, removeChangeListener, removeItemListener, removeNotify, setAction, setActionCommand, setBorderPainted, setContentAreaFilled, setDisabledIcon, setDisabledSelectedIcon, setDisplayedMnemonicIndex, setFocusPainted, setHideActionText, setHorizontalAlignment, setHorizontalTextPosition, setIcon, setIconTextGap, setLabel, setLayout, setMargin, setMnemonic, setMnemonic, setMultiClickThreshhold, setPressedIcon, setRolloverEnabled, setRolloverIcon, setRolloverSelectedIcon, setSelected, setSelectedIcon, setText, setUI, setVerticalAlignment, setVerticalTextPosition |
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, getVerifyInputWhenFocusTarget, getVetoableChangeListeners, getVisibleRect, getWidth, getX, getY, grabFocus, isDoubleBuffered, isLightweightComponent, isManagingFocus, isOpaque, isOptimizedDrawingEnabled, isPaintingForPrint, isPaintingTile, isRequestFocusEnabled, isValidateRoot, paint, paintChildren, paintComponent, paintImmediately, paintImmediately, print, printAll, printBorder, printChildren, printComponent, processComponentKeyEvent, processKeyBinding, processKeyEvent, processMouseEvent, processMouseMotionEvent, putClientProperty, registerKeyboardAction, registerKeyboardAction, removeAncestorListener, 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, setToolTipText, setTransferHandler, setUI, setVerifyInputWhenFocusTarget, setVisible, unregisterKeyboardAction, update |
Methods inherited from class java.awt.Container |
add, add, add, add, add, addContainerListener, 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, 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, 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 |
UIFRadioButtonMenuItem
public UIFRadioButtonMenuItem()
- Constructs a menu item with no set text or icon.
UIFRadioButtonMenuItem
public UIFRadioButtonMenuItem(Icon icon)
- Constructs a menu item with the specified icon.
- Parameters:
icon
- the icon of the menu item
UIFRadioButtonMenuItem
public UIFRadioButtonMenuItem(String text)
- Constructs a menu item with the specified text.
- Parameters:
text
- the text of the menu item
UIFRadioButtonMenuItem
public UIFRadioButtonMenuItem(String text,
boolean selected)
- Constructs a radio button menu item with the specified text
and selection state.
- Parameters:
text
- the text of the menu itemselected
- the selected state of the menu item
UIFRadioButtonMenuItem
public UIFRadioButtonMenuItem(Icon icon,
boolean selected)
- Constructs a menu item with the specified icon.
- Parameters:
icon
- the icon of the menu itemselected
- the selected state of the menu item
UIFRadioButtonMenuItem
public UIFRadioButtonMenuItem(Action action)
- Constructs a radio button menu item whose properties are taken
from the specified
Action
.
- Parameters:
action
- the action that provides the properties
UIFRadioButtonMenuItem
public UIFRadioButtonMenuItem(ToggleAction toggleAction)
- Constructs a radio button menu item whose properties are taken
from the specified
ToggleAction
. Also sets
the menu item's model to the model provided by the toggle action.
- Parameters:
toggleAction
- the action that provides the properties
UIFRadioButtonMenuItem
public UIFRadioButtonMenuItem(String text,
Icon icon)
- Constructs a menu item with the specified text and icon.
- Parameters:
text
- the text of the menu itemicon
- the icon of the menu item
UIFRadioButtonMenuItem
public UIFRadioButtonMenuItem(String text,
Icon icon,
boolean selected)
- Constructs a radio button menu item that has the specified
text, image, and selection state. All other constructors
defer to this one.
- Parameters:
text
- the string displayed on the radio buttonicon
- the image that the button should displayselected
- if true, the button is initially selected;
otherwise, the button is initially unselected
UIFRadioButtonMenuItem
public UIFRadioButtonMenuItem(String text,
int mnemonic)
- Constructs a menu item with the specified text and
keyboard mnemonic.
- Parameters:
text
- the text of the menu itemmnemonic
- the keyboard mnemonic for the menu item
UIFRadioButtonMenuItem
public UIFRadioButtonMenuItem(String text,
int mnemonic,
boolean selected)
- Constructs a menu item with the specified text and
keyboard mnemonic.
- Parameters:
text
- the text of the menu itemmnemonic
- the keyboard mnemonic for the menu itemselected
- if true, the button is initially selected;
otherwise, the button is initially unselected
UIFRadioButtonMenuItem
public UIFRadioButtonMenuItem(String text,
Icon icon,
int mnemonic)
- Constructs a menu item with the specified text, icon and
keyboard mnemonic.
- Parameters:
text
- the text of the menu itemicon
- the icon of the menu itemmnemonic
- the keyboard mnemonic for the menu item
UIFRadioButtonMenuItem
public UIFRadioButtonMenuItem(String text,
Icon icon,
int mnemonic,
boolean selected)
- Constructs a menu item with the specified text, icon and
keyboard mnemonic.
- Parameters:
text
- the text of the menu itemicon
- the icon of the menu itemmnemonic
- the keyboard mnemonic for the menu itemselected
- if true, the button is initially selected;
otherwise, the button is initially unselected
isIconVisible
public boolean isIconVisible()
- Answers whether icons are currently visible or hidden.
- Returns:
- true if icons are visible, false if invisible
setIconVisible
public void setIconVisible(boolean newVisible)
- Shows or hides this item's icons. In case the icons are hidden
they are stored in private fields so they can be restored later.
The current implementations override icons during the restoring proces
that have been set between the hide and show actions.
- Parameters:
newVisible
- true for visible, false for invisible
getIconVisibleMode
public Mode getIconVisibleMode()
- Returns the current icon mode that determines
whether this item shows or hides an icon - if any.
- Returns:
- the current icon mode
setIconVisibleMode
public void setIconVisibleMode(Mode newMode)
- Sets a new icon visible mode that determines whether
this item shows or hides an icon - if any.
- Parameters:
newMode
- the icon visible mode to be set
configurePropertiesFromAction
protected void configurePropertiesFromAction(Action a)
- In addition to the superclass behavior, this class
sets the displayed mnemonic index if and only if the
action provides one under key
"mnemonicIndex"
.
- Overrides:
configurePropertiesFromAction
in class JMenuItem
- Parameters:
a
- the Action
from which to get the properties,
or null
- See Also:
Action
updateUI
public void updateUI()
- In addition to the superclass behavior that updates the UI
this method adds or removes the item's icon according to the
icon visible mode's current enabled value - if any.
- Overrides:
updateUI
in class JMenuItem
Copyright © 2000-2008 JGoodies Karsten Lentzsch. All Rights Reserved.