public class ActionGroup extends Object
Actions are generally organized into groups. All Actions that would make sense to use in a particular context should be in a single group. Multiple ActionGroups may be used for a particular user interface. In fact, it is expected that most nontrivial applications will make use of multiple ActionGroups. For example, in an application that can edit multiple documents, you would likely have one ActionGroup holding global Actions (e.g. quit, about, new), and one ActionGroup per document holding Actions that act on that document (eg. save, cut/copy/paste, etc). Each Window's Menus would be constructed from a combination of two ActionGroups.
Constructor and Description |
---|
ActionGroup(String name)
Create a new ActionGroup.
|
Modifier and Type | Method and Description |
---|---|
void |
addAction(Action action)
Adds an Action to this ActionGroup.
|
boolean |
getSensitive()
Whether this ActionGroup is sensitive, i.e., if its Actions can be
activated by users.
|
boolean |
getVisible()
Get if this ActionGroup is visible for the user.
|
void |
setSensitive(boolean sensitive)
Sets whether Actions in this ActionGroup can respond to user events.
|
void |
setVisible(boolean visible)
Sets whether Actions in this ActionGroup are visible to the user.
|
public ActionGroup(String name)
name
- TODO what the name is for? it seems only useful for
accelerator questions that we will expose in another way!public void addAction(Action action)
public boolean getSensitive()
public boolean getVisible()
public void setSensitive(boolean sensitive)
Notice that both the Action itself and the ActionGroup need to be
sensitive to actually allow the user to activate the Action. See
Action.setSensitive()
for the
other half of this equation.
public void setVisible(boolean visible)
Notice that both the Action itself and the ActionGroup need to be
visible in order the users can see them displayed on screen. See
Action.setVisible()
for the
corresponding per-Action method.