public class TrayItem extends Item
IMPORTANT: This class is not intended to be subclassed.
Constructor and Description |
---|
TrayItem(Tray parent,
int style)
Constructs a new instance of this class given its parent
(which must be a
Tray ) and a style value
describing its behavior and appearance. |
Modifier and Type | Method and Description |
---|---|
void |
addSelectionListener(SelectionListener listener)
Adds the listener to the collection of listeners who will
be notified when the receiver is selected, by sending
it one of the messages defined in the
SelectionListener
interface. |
protected void |
checkSubclass()
Checks that this class can be subclassed.
|
Tray |
getParent()
Returns the receiver's parent, which must be a
Tray . |
ToolTip |
getToolTip()
Returns the receiver's tool tip, or null if it has
not been set.
|
String |
getToolTipText()
Returns the receiver's tool tip text, or null if it has
not been set.
|
boolean |
getVisible()
Returns
true if the receiver is visible and
false otherwise. |
void |
removeSelectionListener(SelectionListener listener)
Removes the listener from the collection of listeners who will
be notified when the receiver is selected.
|
void |
setImage(Image image)
Sets the receiver's image.
|
void |
setToolTip(ToolTip toolTip)
Sets the receiver's tool tip to the argument, which
may be null indicating that no tool tip should be shown.
|
void |
setToolTipText(String value)
Sets the receiver's tool tip text to the argument, which
may be null indicating that no tool tip text should be shown.
|
void |
setVisible(boolean visible)
Makes the receiver visible if the argument is
true ,
and makes it invisible otherwise. |
addDisposeListener, addListener, checkWidget, dispose, getData, getData, getDisplay, getStyle, isDisposed, isListening, notifyListeners, removeDisposeListener, removeListener, removeListener, setData, setData, toString
public TrayItem(Tray parent, int style)
Tray
) 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.
parent
- a composite control which will be the parent of the new instance (cannot be null)style
- the style of control to constructIllegalArgumentException
- SWTException
- SWT
,
Widget.checkSubclass()
,
Widget.getStyle()
public void addSelectionListener(SelectionListener listener)
SelectionListener
interface.
widgetSelected
is called when the receiver is selected
widgetDefaultSelected
is called when the receiver is double-clicked
listener
- the listener which should be notifiedIllegalArgumentException
- SWTException
- SelectionListener
,
removeSelectionListener(org.eclipse.swt.events.SelectionListener)
,
SelectionEvent
protected void checkSubclass()
Widget
The SWT class library is intended to be subclassed
only at specific, controlled points (most notably,
Composite
and Canvas
when
implementing new widgets). This method enforces this
rule unless it is overridden.
IMPORTANT: By providing an implementation of this method that allows a subclass of a class which does not normally allow subclassing to be created, the implementer agrees to be fully responsible for the fact that any such subclass will likely fail between SWT releases and will be strongly platform specific. No support is provided for user-written classes which are implemented in this fashion.
The ability to subclass outside of the allowed SWT classes is intended purely to enable those not on the SWT development team to implement patches in order to get around specific limitations in advance of when those limitations can be addressed by the team. Subclassing should not be attempted without an intimate and detailed understanding of the hierarchy.
checkSubclass
in class Item
public Tray getParent()
Tray
.SWTException
- public ToolTip getToolTip()
SWTException
- public String getToolTipText()
SWTException
- public boolean getVisible()
true
if the receiver is visible and
false
otherwise.SWTException
- public void removeSelectionListener(SelectionListener listener)
listener
- the listener which should no longer be notifiedIllegalArgumentException
- SWTException
- SelectionListener
,
addSelectionListener(org.eclipse.swt.events.SelectionListener)
public void setImage(Image image)
setImage
in class Item
image
- the new imageIllegalArgumentException
- SWTException
- public void setToolTip(ToolTip toolTip)
toolTip
- the new tool tip (or null)SWTException
- public void setToolTipText(String value)
value
- the new tool tip text (or null)SWTException
- public void setVisible(boolean visible)
true
,
and makes it invisible otherwise.visible
- the new visibility stateSWTException
- Guidelines for using Eclipse APIs. Copyright (c) IBM Corp. and others 2000, 2006. All rights reserved.