public class FloatingText
extends org.eclipse.swt.widgets.Composite
Style SEPARATOR leaves a gap between the label and the text of one pixel in
the color set by Control.setBackground(Color)
. To add more space use the
setSeparatorSpace(int)
method.
Note: Only one of the styles MULTI and SINGLE may be specified, and only one of the styles LEFT, CENTER, and RIGHT may be specified.
Note: The styles ICON_CANCEL and ICON_SEARCH are hints used in combination with SEARCH. When the platform supports the hint, the text control shows these icons. When an icon is selected, a default selection event is sent with the detail field set to one of ICON_CANCEL or ICON_SEARCH. Normally, application code does not need to check the detail. In the case of ICON_CANCEL, the text is cleared before the default selection event is sent causing the application to search for an empty string.
Constructor and Description |
---|
FloatingText(org.eclipse.swt.widgets.Composite pParent,
int pStyle)
Constructs a new instance of this class given its parent and a style value
describing its behavior and appearance.
|
Modifier and Type | Method and Description |
---|---|
org.eclipse.swt.graphics.Point |
computeSize(int pWidthHint,
int pHeightHint,
boolean pChanged) |
org.eclipse.swt.widgets.Label |
getLabel() |
int |
getLabelRatio()
The default is 90 which means that the label height is 90% of the text text
height.
|
org.eclipse.swt.layout.GridLayout |
getLayout() |
org.eclipse.swt.widgets.Text |
getText() |
void |
setBackgroundColors(org.eclipse.swt.graphics.Color color)
Sets the backgrounds of the label and the text to the provided color.
|
void |
setEnabled(boolean pEnabled) |
void |
setForegroundColors(org.eclipse.swt.graphics.Color color)
Sets the foregrounds of the label and the text to the provided color.
|
void |
setRatio(int ratio)
Sets the height of the label as ratio of the text height where 100 means that
the label and text are the same size.
|
FloatingText |
setSeparatorSpace(int space)
If you have used the SWT.SEPARATOR style hint then you can set the width of
the separator here.
|
changed, checkSubclass, drawBackground, getBackgroundMode, getChildren, getLayoutDeferred, getTabList, isLayoutDeferred, layout, layout, layout, layout, layout, setBackgroundMode, setFocus, setLayout, setLayoutDeferred, setTabList
computeTrim, getClientArea, getHorizontalBar, getScrollbarsMode, getVerticalBar
addControlListener, addDragDetectListener, addFocusListener, addGestureListener, addHelpListener, addKeyListener, addMenuDetectListener, addMouseListener, addMouseMoveListener, addMouseTrackListener, addMouseWheelListener, addPaintListener, addTouchListener, addTraverseListener, computeSize, dragDetect, dragDetect, forceFocus, getAccessible, getBackground, getBackgroundImage, getBorderWidth, getBounds, getCursor, getDragDetect, getEnabled, getFont, getForeground, getLayoutData, getLocation, getMenu, getMonitor, getOrientation, getParent, getRegion, getShell, getSize, getTextDirection, getToolTipText, getTouchEnabled, getVisible, internal_dispose_GC, internal_new_GC, isEnabled, isFocusControl, isReparentable, isVisible, moveAbove, moveBelow, pack, pack, print, redraw, redraw, removeControlListener, removeDragDetectListener, removeFocusListener, removeGestureListener, removeHelpListener, removeKeyListener, removeMenuDetectListener, removeMouseListener, removeMouseMoveListener, removeMouseTrackListener, removeMouseWheelListener, removePaintListener, removeTouchListener, removeTraverseListener, requestLayout, setBackground, setBackgroundImage, setBounds, setBounds, setCapture, setCursor, setDragDetect, setFont, setForeground, setLayoutData, setLocation, setLocation, setMenu, setOrientation, setParent, setRedraw, setRegion, setSize, setSize, setTextDirection, setToolTipText, setTouchEnabled, setVisible, toControl, toControl, toDisplay, toDisplay, traverse, traverse, traverse, update
addDisposeListener, addListener, checkWidget, dispose, getData, getData, getDisplay, getListeners, getStyle, isAutoDirection, isDisposed, isListening, notifyListeners, removeDisposeListener, removeListener, removeListener, reskin, setData, setData, toString
public FloatingText(org.eclipse.swt.widgets.Composite pParent, int pStyle)
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 NOT 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 constructjava.lang.IllegalArgumentException
- org.eclipse.swt.SWTException
- SWT.SEPARATOR
,
SWT.SINGLE
,
SWT.MULTI
,
SWT.READ_ONLY
,
SWT.WRAP
,
SWT.LEFT
,
SWT.RIGHT
,
SWT.CENTER
,
SWT.PASSWORD
,
SWT.SEARCH
,
SWT.BORDER
,
SWT.H_SCROLL
,
SWT.V_SCROLL
,
SWT.LEFT_TO_RIGHT
,
SWT.RIGHT_TO_LEFT
,
SWT.FLIP_TEXT_DIRECTION
,
Widget.checkSubclass()
,
Widget.getStyle()
public org.eclipse.swt.graphics.Point computeSize(int pWidthHint, int pHeightHint, boolean pChanged)
computeSize
in class org.eclipse.swt.widgets.Control
public org.eclipse.swt.widgets.Label getLabel()
public org.eclipse.swt.layout.GridLayout getLayout()
getLayout
in class org.eclipse.swt.widgets.Composite
public org.eclipse.swt.widgets.Text getText()
public void setEnabled(boolean pEnabled)
setEnabled
in class org.eclipse.swt.widgets.Control
public void setBackgroundColors(org.eclipse.swt.graphics.Color color)
color
- the color.public void setForegroundColors(org.eclipse.swt.graphics.Color color)
color
- the color.public void setRatio(int ratio)
ratio
- the ratio of the label versus the text heightpublic int getLabelRatio()
setRatio(int)
public FloatingText setSeparatorSpace(int space)
space
- the amount of pixels