站内搜索: 请输入搜索关键词
当前页面: 在线文档首页 > NetBeans API Javadoc 5.5.0

Actions (NetBeans UI Utilities API) - NetBeans API Javadoc 5.5.0

org.openide.awt 6.7.22

org.openide.awt
Class Actions

java.lang.Object
  extended by org.openide.awt.Actions

public class Actions
extends Object

Supporting class for manipulation with menu and toolbar presenters.


Nested Class Summary
static class Actions.CheckboxMenuItem
          CheckboxMenuItem extends the java.awt.CheckboxMenuItem and adds a connection to boolean state actions.
static class Actions.MenuItem
          Extension of Swing menu item with connection to system actions.
static class Actions.SubMenu
          SubMenu provides easy way of displaying submenu items based on SubMenuModel.
static interface Actions.SubMenuModel
          Interface for the creating Actions.SubMenu.
static class Actions.ToolbarButton
          Component shown in toolbar, representing an action.
static class Actions.ToolbarToggleButton
          The Component for BooleeanState action that is to be shown in a toolbar.
 
Constructor Summary
Actions()
           
 
Method Summary
static void connect(AbstractButton button, Action action)
          Connects buttons to action.
static void connect(AbstractButton button, BooleanStateAction action)
          Connects buttons to action.
static void connect(AbstractButton button, SystemAction action)
          Deprecated. Use connect(AbstractButton, Action) instead.
static void connect(JCheckBoxMenuItem item, BooleanStateAction action, boolean popup)
          Attaches checkbox menu item to boolean state action.
static void connect(JMenuItem item, Action action, boolean popup)
          Attaches menu item to an action.
static void connect(JMenuItem item, SystemAction action, boolean popup)
          Deprecated. Use connect(JMenuItem, Action, boolean) instead.
static String cutAmpersand(String text)
          Removes an ampersand from a text string; commonly used to strip out unneeded mnemonics.
static String findKey(SystemAction action)
          Method that finds the keydescription assigned to this action.
static void setMenuText(AbstractButton item, String text, boolean useMnemonic)
          Deprecated. Use either AbstractButton.setText(java.lang.String) or Mnemonics.setLocalizedText(AbstractButton, String) as appropriate.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Actions

public Actions()
Method Detail

findKey

public static String findKey(SystemAction action)
Method that finds the keydescription assigned to this action.

Parameters:
action - action to find key for
Returns:
the text representing the key or null if there is no text assigned

connect

public static void connect(JMenuItem item,
                           SystemAction action,
                           boolean popup)
Deprecated. Use connect(JMenuItem, Action, boolean) instead.

Attaches menu item to an action.

Parameters:
item - menu item
action - action
popup - create popup or menu item

connect

public static void connect(JMenuItem item,
                           Action action,
                           boolean popup)
Attaches menu item to an action.

Parameters:
item - menu item
action - action
popup - create popup or menu item
Since:
3.29

connect

public static void connect(JCheckBoxMenuItem item,
                           BooleanStateAction action,
                           boolean popup)
Attaches checkbox menu item to boolean state action.

Parameters:
item - menu item
action - action
popup - create popup or menu item

connect

public static void connect(AbstractButton button,
                           SystemAction action)
Deprecated. Use connect(AbstractButton, Action) instead.

Connects buttons to action.

Parameters:
button - the button
action - the action

connect

public static void connect(AbstractButton button,
                           Action action)
Connects buttons to action. If the action supplies value for "iconBase" key from getValue(String) with a path to icons the methods setIcon, setPressedIcon, setDisabledIcon and setRolloverIcon will be called on the button with loaded icons using the iconBase. E.g. if the value for "iconBase" will be "com/mycompany/myIcon.gif" following images will be tried "com/mycompany/myIcon.gif" for setIcon, "com/mycompany/myIcon_pressed.gif" for setPressedIcon, "com/mycompany/myIcon_disabled.gif" for setDisabledIcon and "com/mycompany/myIcon_rollover.gif" for setRolloverIcon. SystemAction has special support for iconBase - please check SystemAction.iconResource() for more details.

Parameters:
button - the button
action - the action
Since:
3.29

connect

public static void connect(AbstractButton button,
                           BooleanStateAction action)
Connects buttons to action.

Parameters:
button - the button
action - the action

setMenuText

public static void setMenuText(AbstractButton item,
                               String text,
                               boolean useMnemonic)
Deprecated. Use either AbstractButton.setText(java.lang.String) or Mnemonics.setLocalizedText(AbstractButton, String) as appropriate.

Sets the text for the menu item or other subclass of AbstractButton. Cut from the name '&' char.

Parameters:
item - AbstractButton
text - new label
useMnemonic - if true and '&' char found in new text, next char is used as Mnemonic.

cutAmpersand

public static String cutAmpersand(String text)
Removes an ampersand from a text string; commonly used to strip out unneeded mnemonics. Replaces the first occurence of &? by ? or (&?? by the empty string where ? is a wildcard for any character. &? is a shortcut in English locale. (&?) is a shortcut in Japanese locale. Used to remove shortcuts from workspace names (or similar) when shortcuts are not supported.

The current implementation behaves in the same way regardless of locale. In case of a conflict it would be necessary to change the behavior based on the current locale.

Parameters:
text - a localized label that may have mnemonic information in it
Returns:
string without first & if there was any

org.openide.awt 6.7.22

Built on May 28 2007.  |  Portions Copyright 1997-2005 Sun Microsystems, Inc. All rights reserved.