コード例 #1
0
 public void actionPerformed(final ActionEvent ae) {
   System.out.println("About performed.");
   JOptionPane.showMessageDialog(
       frame,
       "SharedActions illustrates one way of handling\n"
           + "AbstractActions in a Swing application.\n\n"
           + "The author can be reached at [email protected]\n\n",
       "About SharedActions",
       JOptionPane.INFORMATION_MESSAGE);
   SharedActions.setActionEnabled(SharedActions.ACTION1_KEY, true);
   SharedActions.setActionEnabled(SharedActions.ACTION2_KEY, true);
   SharedActions.setActionSelected(SharedActions.ACTION3_KEY, true);
   SharedActions.setActionSelected(SharedActions.ACTION4_KEY, true);
 }
コード例 #2
0
  /** Populate a map of actions. */
  private void buildActionTable() {
    actionTable.put(SharedActions.ABOUT_KEY, new AboutAction());
    actionTable.put(SharedActions.EXIT_KEY, new ExitAction());
    actionTable.put(SharedActions.ACTION1_KEY, new Action1());
    actionTable.put(SharedActions.ACTION2_KEY, new Action2());

    Action action = new Action3();
    toggleListTable.put(action, new ArrayList<AbstractButton>());
    actionTable.put(SharedActions.ACTION3_KEY, action);

    action = new Action4();
    toggleListTable.put(action, new ArrayList<AbstractButton>());
    actionTable.put(SharedActions.ACTION4_KEY, action);

    //	initialize the ACTION2_KEY components.
    SharedActions.setActionEnabled(SharedActions.ACTION2_KEY, false);
  }
コード例 #3
0
 public void actionPerformed(final ActionEvent ae) {
   System.out.println("Action 2 performed.");
   SharedActions.setActionEnabled(SharedActions.ACTION1_KEY, true);
   SharedActions.setActionEnabled(SharedActions.ACTION2_KEY, false);
 }