Package com.jidesoft.utils
Class ActionSupportForJDK5
- java.lang.Object
-
- com.jidesoft.utils.ActionSupportForJDK5
-
public class ActionSupportForJDK5 extends java.lang.ObjectIn 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.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.Action action = new AbstractAction("Text") {...}; JButton button = new JButton(action); ActionSupportForJDK5.install(button);
-
-
Field Summary
Fields Modifier and Type Field Description protected static java.lang.StringCLIENT_PROPERTY_ITEM_LISTENERprotected static java.lang.StringCLIENT_PROPERTY_PROPERTY_CHANGE_LISTENERstatic java.lang.StringDISPLAYED_MNEMONIC_INDEX_KEYstatic java.lang.StringLARGE_ICON_KEYstatic java.lang.StringSELECTED_KEY
-
Constructor Summary
Constructors Constructor Description ActionSupportForJDK5()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static voidactionPropertyChanged(javax.swing.AbstractButton button, javax.swing.Action action, java.lang.String propertyName)static intgetDisplayedMnemonicIndex(javax.swing.Action action)static javax.swing.IcongetLargeIcon(javax.swing.Action action)static booleanhasDisplayedMnemonicIndex(javax.swing.Action action)static voidinstall(javax.swing.AbstractButton button)static voidinstall(javax.swing.AbstractButton button, javax.swing.Action action)static booleanisActionSelected(javax.swing.Action action)static voidsetActionSelected(javax.swing.Action action, boolean selected)static voidsetDisplayedMnemonicIndex(javax.swing.Action action, int newIndex)static voidsetLargeIcon(javax.swing.Action action, javax.swing.Icon icon)static voiduninstall(javax.swing.AbstractButton button)static voiduninstall(javax.swing.AbstractButton button, javax.swing.Action action)
-
-
-
Field Detail
-
SELECTED_KEY
public static final java.lang.String SELECTED_KEY
- See Also:
- Constant Field Values
-
DISPLAYED_MNEMONIC_INDEX_KEY
public static final java.lang.String DISPLAYED_MNEMONIC_INDEX_KEY
- See Also:
- Constant Field Values
-
LARGE_ICON_KEY
public static final java.lang.String LARGE_ICON_KEY
- See Also:
- Constant Field Values
-
CLIENT_PROPERTY_PROPERTY_CHANGE_LISTENER
protected static final java.lang.String CLIENT_PROPERTY_PROPERTY_CHANGE_LISTENER
- See Also:
- Constant Field Values
-
CLIENT_PROPERTY_ITEM_LISTENER
protected static final java.lang.String CLIENT_PROPERTY_ITEM_LISTENER
- See Also:
- Constant Field Values
-
-
Method Detail
-
setActionSelected
public static void setActionSelected(javax.swing.Action action, boolean selected)
-
isActionSelected
public static boolean isActionSelected(javax.swing.Action action)
-
setDisplayedMnemonicIndex
public static void setDisplayedMnemonicIndex(javax.swing.Action action, int newIndex)
-
hasDisplayedMnemonicIndex
public static boolean hasDisplayedMnemonicIndex(javax.swing.Action action)
-
getDisplayedMnemonicIndex
public static int getDisplayedMnemonicIndex(javax.swing.Action action)
-
setLargeIcon
public static void setLargeIcon(javax.swing.Action action, javax.swing.Icon icon)
-
getLargeIcon
public static javax.swing.Icon getLargeIcon(javax.swing.Action action)
-
install
public static void install(javax.swing.AbstractButton button, javax.swing.Action action)
-
install
public static void install(javax.swing.AbstractButton button)
-
uninstall
public static void uninstall(javax.swing.AbstractButton button, javax.swing.Action action)
-
uninstall
public static void uninstall(javax.swing.AbstractButton button)
-
actionPropertyChanged
public static void actionPropertyChanged(javax.swing.AbstractButton button, javax.swing.Action action, java.lang.String propertyName)
-
-