|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.eclipse.swt.widgets.Widget
org.eclipse.swt.widgets.Control
org.eclipse.swt.widgets.Scrollable
org.eclipse.swt.widgets.Composite
org.eclipse.ercp.swt.mobile.CaptionedControl
public class CaptionedControl
A CaptionedControl is used to display a label (caption) in front of a control. An optional trailing text can be used after the control, for example, to indicate units of measurement.
The highlighting is implementation dependent. Typically, a focused
CaptionedControl will highlight all its elements, i.e. the leading label, the
control, and optional trailing label, when it gets focus. The positioning
order for the captions is determined by the SWT.LEFT_TO_RIGHT
and SWT.RIGHT_TO_LEFT
styles hints.
CaptionedControl does not support nested CaptionedControls. An exception will be thrown when an instance of CaptionedControl is given as the constructor's argument. To change the control contained by the CaptionedControl, a new control can be created using the CaptionedControl as its parent control. The old control must be disposed by the application manually. Only one control can be active and visible in a CaptionedControl. Which control is displayed when multiple controls have been added is implementation-dependent.
When using CaptionedControl in a layout and setting layout data, be sure to set the data on the CaptionedControl instance and not on the captioned widget. The internal layout of the CaptionedControl is not user modifyable.
Example code:
CaptionedControl control = new CaptionedControl(shell, SWT.NONE);
ConstraintedText currency = new ConstraintedText(control, SWT.NONE,
ConstraintedText.NUMERIC);
control.setText("Velocity");
control.getTrailingText("cm");
Note: Even though this class is a subclass of Composite, setting a layout on it is not supported.
IMPORTANT: This class is not intended to be subclassed.
Field Summary |
---|
Fields inherited from class org.eclipse.swt.widgets.Control |
---|
enableTraverse, internal_parent |
Fields inherited from class org.eclipse.swt.widgets.Widget |
---|
internal_handle, internal_style |
Constructor Summary | |
---|---|
CaptionedControl(Composite parent,
int style)
|
Method Summary | |
---|---|
Control[] |
getChildren()
Returns a (possibly empty) array containing the receiver's children. |
Image |
getImage()
Returns the CaptionedControl's icon image, or null if it has never been set. |
java.lang.String |
getText()
Gets the caption text, which will be an empty string if it has never been set. |
java.lang.String |
getTrailingText()
Gets the trailing text, which will be an empty string if it has never been set. |
protected void |
removeInternalFilter()
|
void |
setImage(Image image)
Sets the image as an icon to the CaptionedControl. |
void |
setLayout(Layout layout)
Sets the layout which is associated with the receiver to be the argument which may be null. |
void |
setText(java.lang.String string)
Sets the caption label |
void |
setTrailingText(java.lang.String string)
Sets the trailing label |
Methods inherited from class org.eclipse.swt.widgets.Composite |
---|
allowTraverseByArrowKey, checkSubclass, computeSize, getLayout, getTabList, internal_createHandle, internal_getNativeStyle, internal_removeChild, layout, layout, setBounds, setFocus, setSize, setTabList, traverse |
Methods inherited from class org.eclipse.swt.widgets.Scrollable |
---|
computeTrim, getClientArea, getHorizontalBar, getVerticalBar |
Methods inherited from class org.eclipse.swt.widgets.Widget |
---|
addDisposeListener, addListener, checkWidget, getData, getData, getDisplay, getStyle, internal_sendEvent, isDisposed, isListening, notifyListeners, removeDisposeListener, removeListener, removeListener, sendEvent, setData, setData, toString |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
public CaptionedControl(Composite parent, int style)
Method Detail |
---|
public void setText(java.lang.String string)
string
- the new caption label
java.lang.IllegalArgumentException
- ERROR_NULL_ARGUMENT
if the text is null
SWTException
- getText()
public void setTrailingText(java.lang.String string)
string
- the new trailing label
java.lang.IllegalArgumentException
- SWTException
- getTrailingText()
public java.lang.String getText()
SWTException
- setText(java.lang.String)
public void setLayout(Layout layout)
Composite
setLayout
in class Composite
layout
- the receiver's new layout or nullpublic java.lang.String getTrailingText()
SWTException
- setTrailingText(java.lang.String)
public void setImage(Image image)
The parameter can be null indicating that no image should be displayed. The implementation will adjust the image size to make it best fit the CaptionedControl.
image
- the image to display on the receiver
java.lang.IllegalArgumentException
- SWTException
- public Image getImage()
SWTException
- setImage(Image)
public Control[] getChildren()
Composite
Note: This is not the actual structure used by the receiver to maintain its list of children, so modifying the array will not affect the receiver.
getChildren
in class Composite
Control.moveAbove(org.eclipse.swt.widgets.Control)
,
Control.moveBelow(org.eclipse.swt.widgets.Control)
protected void removeInternalFilter()
removeInternalFilter
in class Widget
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |