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 voidactionPropertyChanged(AbstractButton button, Action action, String propertyName) static intgetDisplayedMnemonicIndex(Action action) static IcongetLargeIcon(Action action) static booleanhasDisplayedMnemonicIndex(Action action) static voidinstall(AbstractButton button) static voidinstall(AbstractButton button, Action action) static booleanisActionSelected(Action action) static voidsetActionSelected(Action action, boolean selected) static voidsetDisplayedMnemonicIndex(Action action, int newIndex) static voidsetLargeIcon(Action action, Icon icon) static voiduninstall(AbstractButton button) static voiduninstall(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
-