Creating Actions

Action objects are used for menu items, toolbar buttons and plain buttons. In Genuine, an Action object has to inherit from GenuineAction. Every GenuineAction object must be initialized with a proper resource item (see Using Resources). You therefore have to create both some resource entries in a properties file and an appropriate sub class of GenuineAction.

Have a look at the following example of the CopyAction. First, the resources are defined:

copy.key=control C

As you can see in the example, the following resources are meaningful in combination with an Action class:

The class CopyAction is implemented as follows:

public class CopyAction extends GenuineAction {

  private ClipboardService clipboardService;

   * Passes an instance of the ClipboardService to be called when the action 
   * is performed.
  CopyAction(ClipboardService clipboardService) {
    this.clipboardService = clipboardService;

   * Calls the clipboard service.
  public void actionPerformed(ActionEvent e) {
    if (clipboardService != null) {

The Action object is initialized by passing the name of the resource item to be used to the super constructor and performing internal initializations.