1 30 31 32 package swingwtx.swing; 33 34 import org.eclipse.swt.widgets.*; 35 import org.eclipse.swt.*; 36 37 public class JMenuItem extends JSWTMenuComponent implements ButtonModel { 38 39 private Shell shell = null; 40 41 public JMenuItem() {setModel(this);} 42 public JMenuItem(Action a) { setAction(a); setModel(this); } 43 public JMenuItem(Icon icon) { this("", icon); } 44 public JMenuItem(String text) {this(text, null); } 45 public JMenuItem(String text, Icon icon) { pText = text; pImage = icon; setModel(this);} 46 public JMenuItem(String text, int mnemonic) { pText = text; setMnemonic(mnemonic); setModel(this);} 47 48 public void setAction(Action a) { 49 if (a.getValue(Action.ACCELERATOR_KEY) != null) { 50 if (a.getValue(Action.ACCELERATOR_KEY) != null) 51 setAccelerator((KeyStroke) a.getValue(Action.ACCELERATOR_KEY)); 52 } 53 super.setAction(a); 54 } 55 56 public void setSwingWTParent(Menu parent, Shell shell) throws Exception { 57 this.shell = shell; 58 peer = new MenuItem(parent, SWT.PUSH); 59 } 60 61 public boolean isSelected() { 62 return false; 63 } 64 65 public void setSelected(boolean b) { 66 } 67 68 public Object [] getSelectedObjects() { 69 return null; 70 } 71 72 public boolean isArmed() { 73 return false; 74 } 75 76 public boolean isPressed() { 77 return isSelected(); 78 } 79 80 public boolean isRollover() { 81 return false; 82 } 83 84 public void setArmed(boolean b) { 85 } 86 87 public void setPressed(boolean b) { 88 } 89 90 public void setRollover(boolean b) { 91 } 92 93 } 94 | Popular Tags |