KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > tc > admin > common > XAbstractAction


1 /*
2  * All content copyright (c) 2003-2006 Terracotta, Inc., except as may otherwise be noted in a separate copyright notice. All rights reserved.
3  */

4 package com.tc.admin.common;
5
6 import java.awt.Toolkit JavaDoc;
7
8 import javax.swing.Action JavaDoc;
9 import javax.swing.AbstractAction JavaDoc;
10 import javax.swing.KeyStroke JavaDoc;
11 import javax.swing.Icon JavaDoc;
12
13 public abstract class XAbstractAction extends AbstractAction JavaDoc {
14   protected static final int MENU_SHORTCUT_KEY_MASK =
15     Toolkit.getDefaultToolkit().getMenuShortcutKeyMask();
16
17   public XAbstractAction() {
18     super();
19   }
20
21   public XAbstractAction(String JavaDoc name) {
22     super(name);
23     setShortDescription(name);
24   }
25
26   public XAbstractAction(String JavaDoc name, Icon JavaDoc icon) {
27     super(name, icon);
28     setShortDescription(name);
29   }
30
31   public void setName(String JavaDoc name) {
32     putValue(Action.NAME, name);
33   }
34
35   public String JavaDoc getName() {
36     return (String JavaDoc)getValue(Action.NAME);
37   }
38
39   public void setSmallIcon(Icon JavaDoc icon) {
40     putValue(Action.SMALL_ICON, icon);
41   }
42
43   public Icon JavaDoc getSmallIcon() {
44     return (Icon JavaDoc)getValue(Action.SMALL_ICON);
45   }
46
47   public void setAccelerator(KeyStroke JavaDoc ks) {
48     putValue(ACCELERATOR_KEY, ks);
49   }
50
51   public KeyStroke JavaDoc getAccelerator() {
52     return (KeyStroke JavaDoc)getValue(ACCELERATOR_KEY);
53   }
54
55   public void setShortDescription(String JavaDoc description) {
56     putValue(Action.SHORT_DESCRIPTION, description);
57   }
58
59   public String JavaDoc getShortDescription() {
60     return (String JavaDoc)getValue(Action.SHORT_DESCRIPTION);
61   }
62
63   public void setLongDescription(String JavaDoc description) {
64     putValue(Action.LONG_DESCRIPTION, description);
65   }
66
67   public String JavaDoc getLongDescription() {
68     return (String JavaDoc)getValue(Action.LONG_DESCRIPTION);
69   }
70
71 }
72
Popular Tags