public class BadgedLabel
extends org.eclipse.swt.widgets.Canvas
Constructor and Description |
---|
BadgedLabel(org.eclipse.swt.widgets.Composite parent,
int style)
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 wHint,
int hHint,
boolean changed) |
org.eclipse.swt.graphics.Color |
getBackgroundColor()
Returns the background color that the receiver will use to draw.
|
org.eclipse.swt.graphics.Color |
getBadgeBackground()
Returns the background color that the badge will use to draw.
|
org.eclipse.swt.graphics.Color |
getBadgeForeground()
Returns the foreground color that the badge will use to draw.
|
java.lang.String |
getBadgeValue()
Returns the text of the badge
|
org.eclipse.swt.graphics.Color |
getBorderColor()
Returns the border color that the receiver will use to draw.
|
org.eclipse.swt.graphics.Image |
getImage()
Returns the receiver's image if it has one, or null if it does not.
|
java.lang.String |
getText()
Returns the receiver's text, which will be an empty string if it has never
been set or if the receiver is a
SEPARATOR label. |
org.eclipse.swt.graphics.Color |
getTextColor()
Returns the text color that the receiver will use to draw.
|
void |
setBackgroundColor(org.eclipse.swt.graphics.Color backgroundColor)
Sets the receiver's background color to the color specified by the argument
|
void |
setBadgeBackground(org.eclipse.swt.graphics.Color badgeBackground)
Sets the badge's background color to the color specified by the argument
|
void |
setBadgeForeground(org.eclipse.swt.graphics.Color badgeForeground)
Sets the badge's foreground color to the color specified by the argument
|
void |
setBadgeValue(java.lang.String value)
Sets the badge's value (text) to the text specified by the argument
|
void |
setBorderColor(org.eclipse.swt.graphics.Color borderColor)
Sets the receiver's border color to the color specified by the argument
|
void |
setEnabled(boolean enabled) |
void |
setFont(org.eclipse.swt.graphics.Font font) |
void |
setImage(org.eclipse.swt.graphics.Image image)
Sets the receiver's image to the argument, which may be null indicating that
no image should be displayed.
|
void |
setPredefinedColor(int color)
Sets the badge's color theme to the theme specified by the argument
|
void |
setText(java.lang.String text)
Sets the receiver's text.
|
void |
setTextColor(org.eclipse.swt.graphics.Color textColor)
Sets the receiver's text color to the color specified by the argument
|
drawBackground, getCaret, getIME, scroll, setCaret, setIME
changed, checkSubclass, drawBackground, getBackgroundMode, getChildren, getLayout, 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, 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 BadgedLabel(org.eclipse.swt.widgets.Composite parent, int style)
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 constructjava.lang.IllegalArgumentException
- org.eclipse.swt.SWTException
- public void setPredefinedColor(int color)
color
- the new color, can pick one of the following value:
SWT.COLOR_BLUE, SWT.COLOR_GRAY, SWT.COLOR_GREEN, SWT.COLOR_RED,
SWT.COLOR_YELLOW, SWT.COLOR_CYAN, SWT.COLOR_BLACKjava.lang.IllegalArgumentException
- org.eclipse.swt.SWTException
- public org.eclipse.swt.graphics.Point computeSize(int wHint, int hHint, boolean changed)
computeSize
in class org.eclipse.swt.widgets.Control
Control.computeSize(int, int, boolean)
public org.eclipse.swt.graphics.Color getBackgroundColor()
org.eclipse.swt.SWTException
- public org.eclipse.swt.graphics.Color getBadgeBackground()
org.eclipse.swt.SWTException
- public org.eclipse.swt.graphics.Color getBadgeForeground()
org.eclipse.swt.SWTException
- public java.lang.String getBadgeValue()
org.eclipse.swt.SWTException
- public org.eclipse.swt.graphics.Color getBorderColor()
org.eclipse.swt.SWTException
- public org.eclipse.swt.graphics.Image getImage()
org.eclipse.swt.SWTException
- public java.lang.String getText()
SEPARATOR
label.org.eclipse.swt.SWTException
- public org.eclipse.swt.graphics.Color getTextColor()
org.eclipse.swt.SWTException
- public void setBackgroundColor(org.eclipse.swt.graphics.Color backgroundColor)
color
- the new colorjava.lang.IllegalArgumentException
- org.eclipse.swt.SWTException
- public void setBadgeBackground(org.eclipse.swt.graphics.Color badgeBackground)
color
- the new colorjava.lang.IllegalArgumentException
- org.eclipse.swt.SWTException
- public void setBadgeForeground(org.eclipse.swt.graphics.Color badgeForeground)
color
- the new colorjava.lang.IllegalArgumentException
- org.eclipse.swt.SWTException
- public void setBadgeValue(java.lang.String value)
value
- the new text valuejava.lang.IllegalArgumentException
- org.eclipse.swt.SWTException
- public void setBorderColor(org.eclipse.swt.graphics.Color borderColor)
color
- the new colorjava.lang.IllegalArgumentException
- org.eclipse.swt.SWTException
- public void setEnabled(boolean enabled)
setEnabled
in class org.eclipse.swt.widgets.Control
Control.setEnabled(boolean)
public void setFont(org.eclipse.swt.graphics.Font font)
setFont
in class org.eclipse.swt.widgets.Canvas
Canvas.setFont(org.eclipse.swt.graphics.Font)
public void setImage(org.eclipse.swt.graphics.Image image)
image
- the image to display on the receiver (may be null)java.lang.IllegalArgumentException
- org.eclipse.swt.SWTException
- public void setText(java.lang.String text)
This method sets the widget label. The label may include the mnemonic character and line delimiters.
Mnemonics are indicated by an '&' that causes the next character to be the mnemonic. When the user presses a key sequence that matches the mnemonic, focus is assigned to the control that follows the label. On most platforms, the mnemonic appears underlined but may be emphasised in a platform specific manner. The mnemonic indicator character '&' can be escaped by doubling it in the string, causing a single '&' to be displayed.
Note: If control characters like '\n', '\t' etc. are used in the string, then the behavior is platform dependent.
string
- the new textjava.lang.IllegalArgumentException
- org.eclipse.swt.SWTException
- public void setTextColor(org.eclipse.swt.graphics.Color textColor)
color
- the new colorjava.lang.IllegalArgumentException
- org.eclipse.swt.SWTException
-