org.eclipse.swt.widgets
abstract public class: Item [javadoc |
source]
java.lang.Object
org.eclipse.swt.widgets.Widget
org.eclipse.swt.widgets.Item
Direct Known Subclasses:
CoolItem, TableColumn, TrayItem, TableTreeItem, TreeColumn, TableItem, CTabItem, TreeItem, TabItem, ToolItem, MenuItem, ExpandItem
This class is the abstract superclass of all non-windowed
user interface objects that occur within specific controls.
For example, a tree will contain tree items.
- Styles:
- (none)
- Events:
- (none)
Field Summary |
---|
String | text | |
Image | image | |
Fields inherited from org.eclipse.swt.widgets.Widget: |
---|
style, state, display, eventTable, data, DISPOSED, CANVAS, KEYED_DATA, DISABLED, HIDDEN, LAYOUT_NEEDED, LAYOUT_CHANGED, LAYOUT_CHILD, THEME_BACKGROUND, DRAW_BACKGROUND, PARENT_BACKGROUND, RELEASED, DISPOSE_SENT, TRACK_MOUSE, FOREIGN_HANDLE, DRAG_DETECT, MOVE_OCCURRED, MOVE_DEFERRED, RESIZE_OCCURRED, RESIZE_DEFERRED, IGNORE_WM_CHANGEUISTATE, DEFAULT_WIDTH, DEFAULT_HEIGHT, MAJOR, MINOR |
Constructor: |
public Item(Widget parent,
int style) {
super (parent, style);
text = "";
}
Constructs a new instance of this class given its parent
and a style value describing its behavior and appearance.
The item is added to the end of the items maintained by its parent.
The style value is either one of the style constants defined in
class SWT which is applicable to instances of this
class, or must be built by bitwise OR'ing together
(that is, using the int "|" operator) two or more
of those SWT style constants. The class description
lists the style constants that are applicable to the class.
Style bits are also inherited from superclasses.
Parameters:
parent - a widget which will be the parent of the new instance (cannot be null)
style - the style of item to construct
Throws:
IllegalArgumentException -
- ERROR_NULL_ARGUMENT - if the parent is null
SWTException -
- ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the parent
Also see:
- SWT
- getStyle
- exception:
IllegalArgumentException -
- ERROR_NULL_ARGUMENT - if the parent is null
- exception:
SWTException -
- ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the parent
|
public Item(Widget parent,
int style,
int index) {
this (parent, style);
}
Constructs a new instance of this class given its parent
and a style value describing its behavior and appearance,
and the index at which to place it in the items maintained
by its parent.
The style value is either one of the style constants defined in
class SWT which is applicable to instances of this
class, or must be built by bitwise OR'ing together
(that is, using the int "|" operator) two or more
of those SWT style constants. The class description
lists the style constants that are applicable to the class.
Style bits are also inherited from superclasses.
Parameters:
parent - a widget which will be the parent of the new instance (cannot be null)
style - the style of item to construct
index - the index at which to store the receiver in its parent
Throws:
IllegalArgumentException -
- ERROR_NULL_ARGUMENT - if the parent is null
SWTException -
- ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the parent
Also see:
- SWT
- getStyle
- exception:
IllegalArgumentException -
- ERROR_NULL_ARGUMENT - if the parent is null
- exception:
SWTException -
- ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the parent
|
Methods from org.eclipse.swt.widgets.Widget: |
---|
DeferWindowPos, SetWindowPos, _addListener, addDisposeListener, addListener, callWindowProc, checkBits, checkOpened, checkOrientation, checkParent, checkSubclass, checkWidget, destroyWidget, dispose, dragDetect, error, filters, findItem, fixMnemonic, fixMnemonic, getData, getData, getDisplay, getListeners, getMenu, getName, getNameText, getStyle, hooks, isDisposed, isListening, isValidSubclass, isValidThread, mapEvent, new_GC, notifyListeners, postEvent, postEvent, release, releaseChildren, releaseHandle, releaseParent, releaseWidget, removeDisposeListener, removeListener, removeListener, sendDragEvent, sendDragEvent, sendEvent, sendEvent, sendEvent, sendEvent, sendFocusEvent, sendKeyEvent, sendKeyEvent, sendMouseEvent, sendMouseEvent, setData, setData, setInputState, setKeyState, setTabGroupFocus, setTabItemFocus, showMenu, toString, wmCaptureChanged, wmChar, wmContextMenu, wmIMEChar, wmKeyDown, wmKeyUp, wmKillFocus, wmLButtonDblClk, wmLButtonDown, wmLButtonUp, wmMButtonDblClk, wmMButtonDown, wmMButtonUp, wmMouseHover, wmMouseLeave, wmMouseMove, wmMouseWheel, wmNCPaint, wmPaint, wmPrint, wmRButtonDblClk, wmRButtonDown, wmRButtonUp, wmSetFocus, wmSysChar, wmSysKeyDown, wmSysKeyUp, wmXButtonDblClk, wmXButtonDown, wmXButtonUp |
Methods from java.lang.Object: |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Method from org.eclipse.swt.widgets.Item Detail: |
protected void checkSubclass() {
/* Do Nothing - Subclassing is allowed */
}
|
public Image getImage() {
checkWidget ();
return image;
}
Returns the receiver's image if it has one, or null
if it does not. |
String getNameText() {
return getText ();
}
|
public String getText() {
checkWidget();
return text;
}
Returns the receiver's text, which will be an empty
string if it has never been set. |
void releaseWidget() {
super.releaseWidget ();
text = null;
image = null;
}
|
public void setImage(Image image) {
checkWidget ();
if (image != null && image.isDisposed()) error(SWT.ERROR_INVALID_ARGUMENT);
this.image = image;
}
Sets the receiver's image to the argument, which may be
null indicating that no image should be displayed. |
public void setText(String string) {
checkWidget ();
if (string == null) error (SWT.ERROR_NULL_ARGUMENT);
text = string;
}
Sets the receiver's text. |