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