Package com.jidesoft.utils
Class ActionSupportForJDK5
java.lang.Object
com.jidesoft.utils.ActionSupportForJDK5
In JDK6, Swing adds three new properties on Action class: SELECTED_KEY, DISPLAYED_MNEMONIC_INDEX_KEY and LARGE_ICON. You can find more information at
http://weblogs.java.net/blog/zixle/archive/2005/11/changes_to_acti.html
However, for users who are still using JDK5, you are out of luck. In this class, we provide a simple way to use those new properties
on JDK5.
First of all, you need to call this method.
Action action = new AbstractAction("Text") {...};
JButton button = new JButton(action);
ActionSupportForJDK5.install(button);
When you about to change the selected state of action, you call ActionSupportForJDK5.setActionSelected(action, selected). The selected value could
be true or false. This call will automatically make the button selected or not selected.
There are also setDisplayedMnemonicIndex and setLargeIcon methods on ActionSupportForJDK5 to the other two new properties.
Last but not least, if you don't use the button anymore, it is a good practice to call ActionSupportForJDK5.uninstall to remove the installed listeners.-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic void
actionPropertyChanged
(AbstractButton button, Action action, String propertyName) static int
getDisplayedMnemonicIndex
(Action action) static Icon
getLargeIcon
(Action action) static boolean
hasDisplayedMnemonicIndex
(Action action) static void
install
(AbstractButton button) static void
install
(AbstractButton button, Action action) static boolean
isActionSelected
(Action action) static void
setActionSelected
(Action action, boolean selected) static void
setDisplayedMnemonicIndex
(Action action, int newIndex) static void
setLargeIcon
(Action action, Icon icon) static void
uninstall
(AbstractButton button) static void
uninstall
(AbstractButton button, Action action)
-
Field Details
-
SELECTED_KEY
- See Also:
-
DISPLAYED_MNEMONIC_INDEX_KEY
- See Also:
-
LARGE_ICON_KEY
- See Also:
-
CLIENT_PROPERTY_PROPERTY_CHANGE_LISTENER
- See Also:
-
CLIENT_PROPERTY_ITEM_LISTENER
- See Also:
-
-
Constructor Details
-
ActionSupportForJDK5
public ActionSupportForJDK5()
-
-
Method Details
-
setActionSelected
-
isActionSelected
-
setDisplayedMnemonicIndex
-
hasDisplayedMnemonicIndex
-
getDisplayedMnemonicIndex
-
setLargeIcon
-
getLargeIcon
-
install
-
install
-
uninstall
-
uninstall
-
actionPropertyChanged
-