1 11 package org.eclipse.swt.widgets; 12 13 14 import org.eclipse.swt.*; 15 import org.eclipse.swt.graphics.*; 16 17 28 29 public abstract class Item extends Widget { 30 String text; 31 Image image; 32 33 60 public Item (Widget parent, int style) { 61 super (parent, style); 62 text = ""; 63 } 64 65 95 public Item (Widget parent, int style, int index) { 96 this (parent, style); 97 } 98 99 protected void checkSubclass () { 100 101 } 102 103 114 public Image getImage () { 115 checkWidget (); 116 return image; 117 } 118 119 String getNameText () { 120 return getText (); 121 } 122 123 134 public String getText () { 135 checkWidget(); 136 return text; 137 } 138 139 void releaseWidget () { 140 super.releaseWidget (); 141 text = null; 142 image = null; 143 } 144 145 159 public void setImage (Image image) { 160 checkWidget (); 161 if (image != null && image.isDisposed()) error(SWT.ERROR_INVALID_ARGUMENT); 162 this.image = image; 163 } 164 165 178 public void setText (String string) { 179 checkWidget (); 180 if (string == null) error (SWT.ERROR_NULL_ARGUMENT); 181 text = string; 182 } 183 184 } 185 | Popular Tags |