Home » Eclipse-SWT-3.5.1 » org.eclipse.swt.widgets » [javadoc | source]
public class: Label [javadoc | source]

All Implemented Interfaces:

Instances of this class represent a non-selectable user interface object that displays a string or image. When SEPARATOR is specified, displays a single vertical or horizontal line.

Shadow styles are hints and may not be honored by the platform. To create a separator label with the default shadow style for the platform, do not specify a shadow style.


Note: Only one of SHADOW_IN, SHADOW_OUT and SHADOW_NONE may be specified. SHADOW_NONE is a HINT. Only one of HORIZONTAL and VERTICAL may be specified. Only one of CENTER, LEFT and RIGHT may be specified.

IMPORTANT: This class is intended to be subclassed only within the SWT implementation.

Field Summary
 String text     
 Image image     
static final  int MARGIN     
static  boolean IMAGE_AND_TEXT     
static final  int LabelProc     
static final  TCHAR LabelClass     
Fields inherited from org.eclipse.swt.widgets.Control:
handle,  parent,  cursor,  menu,  toolTipText,  layoutData,  accessible,  backgroundImage,  region,  font,  drawCount,  foreground,  background
Fields inherited from org.eclipse.swt.widgets.Widget:
 public Label(Composite parent,
    int style) 
    Constructs a new instance of this class given its parent and a style value describing its behavior and appearance.

    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 construct
    IllegalArgumentException -
    • ERROR_NULL_ARGUMENT - if the parent is null

    SWTException -
    • ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the parent
    • ERROR_INVALID_SUBCLASS - if this class is not an allowed subclass

    Also see:
    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
    • ERROR_INVALID_SUBCLASS - if this class is not an allowed subclass

Method from org.eclipse.swt.widgets.Label Summary:
WM_ERASEBKGND,   WM_PAINT,   WM_SIZE,   WM_UPDATEUISTATE,   callWindowProc,   checkStyle,   computeSize,   createHandle,   getAlignment,   getImage,   getNameText,   getText,   mnemonicHit,   mnemonicMatch,   releaseWidget,   setAlignment,   setImage,   setText,   widgetExtStyle,   widgetStyle,   windowClass,   windowProc,   wmColorChild,   wmDrawChild
Methods from org.eclipse.swt.widgets.Control:
WM_ACTIVATE,   WM_CAPTURECHANGED,   WM_CHANGEUISTATE,   WM_CHAR,   WM_CLEAR,   WM_CLOSE,   WM_COMMAND,   WM_CONTEXTMENU,   WM_CTLCOLOR,   WM_CUT,   WM_DESTROY,   WM_DRAWITEM,   WM_ENDSESSION,   WM_ENTERIDLE,   WM_ERASEBKGND,   WM_GETDLGCODE,   WM_GETFONT,   WM_GETMINMAXINFO,   WM_GETOBJECT,   WM_HELP,   WM_HOTKEY,   WM_HSCROLL,   WM_IME_CHAR,   WM_IME_COMPOSITION,   WM_IME_COMPOSITION_START,   WM_IME_ENDCOMPOSITION,   WM_INITMENUPOPUP,   WM_INPUTLANGCHANGE,   WM_KEYDOWN,   WM_KEYUP,   WM_KILLFOCUS,   WM_LBUTTONDBLCLK,   WM_LBUTTONDOWN,   WM_LBUTTONUP,   WM_MBUTTONDBLCLK,   WM_MBUTTONDOWN,   WM_MBUTTONUP,   WM_MEASUREITEM,   WM_MENUCHAR,   WM_MENUSELECT,   WM_MOUSEACTIVATE,   WM_MOUSEHOVER,   WM_MOUSELEAVE,   WM_MOUSEMOVE,   WM_MOUSEWHEEL,   WM_MOVE,   WM_NCACTIVATE,   WM_NCCALCSIZE,   WM_NCHITTEST,   WM_NCLBUTTONDOWN,   WM_NCPAINT,   WM_NOTIFY,   WM_PAINT,   WM_PALETTECHANGED,   WM_PARENTNOTIFY,   WM_PASTE,   WM_PRINT,   WM_PRINTCLIENT,   WM_QUERYENDSESSION,   WM_QUERYNEWPALETTE,   WM_QUERYOPEN,   WM_RBUTTONDBLCLK,   WM_RBUTTONDOWN,   WM_RBUTTONUP,   WM_SETCURSOR,   WM_SETFOCUS,   WM_SETFONT,   WM_SETREDRAW,   WM_SETTINGCHANGE,   WM_SHOWWINDOW,   WM_SIZE,   WM_SYSCHAR,   WM_SYSCOLORCHANGE,   WM_SYSCOMMAND,   WM_SYSKEYDOWN,   WM_SYSKEYUP,   WM_TIMER,   WM_UNDO,   WM_UPDATEUISTATE,   WM_VSCROLL,   WM_WINDOWPOSCHANGED,   WM_WINDOWPOSCHANGING,   WM_XBUTTONDBLCLK,   WM_XBUTTONDOWN,   WM_XBUTTONUP,   addControlListener,   addDragDetectListener,   addFocusListener,   addHelpListener,   addKeyListener,   addMenuDetectListener,   addMouseListener,   addMouseMoveListener,   addMouseTrackListener,   addMouseWheelListener,   addPaintListener,   addTraverseListener,   borderHandle,   checkBackground,   checkBorder,   checkBuffered,   checkComposited,   checkHandle,   checkMirrored,   computeSize,   computeSize,   computeTabGroup,   computeTabList,   computeTabRoot,   createHandle,   createWidget,   defaultBackground,   defaultFont,   defaultForeground,   deregister,   destroyWidget,   dragDetect,   dragDetect,   dragDetect,   drawBackground,   drawBackground,   drawBackground,   drawImageBackground,   drawThemeBackground,   enableDrag,   enableWidget,   fillBackground,   fillImageBackground,   fillThemeBackground,   findBackgroundControl,   findBrush,   findCursor,   findImageControl,   findMenus,   findMnemonic,   findThemeControl,   fixChildren,   fixFocus,   forceFocus,   forceResize,   getAccessible,   getBackground,   getBackgroundImage,   getBackgroundPixel,   getBorderWidth,   getBounds,   getClipboardText,   getCodePage,   getCursor,   getDragDetect,   getDrawing,   getEnabled,   getFont,   getForeground,   getForegroundPixel,   getLayoutData,   getLocation,   getMenu,   getMonitor,   getParent,   getPath,   getRegion,   getShell,   getSize,   getToolTipText,   getVisible,   hasCursor,   hasFocus,   internal_dispose_GC,   internal_new_GC,   isActive,   isEnabled,   isFocusAncestor,   isFocusControl,   isReparentable,   isShowing,   isTabGroup,   isTabItem,   isVisible,   mapEvent,   markLayout,   menuShell,   mnemonicHit,   mnemonicMatch,   moveAbove,   moveBelow,   new_Accessible,   new_GC,   pack,   pack,   print,   printWidget,   redraw,   redraw,   redraw,   redrawChildren,   register,   releaseHandle,   releaseParent,   releaseWidget,   removeControlListener,   removeDragDetectListener,   removeFocusListener,   removeHelpListener,   removeKeyListener,   removeMenuDetectListener,   removeMouseListener,   removeMouseMoveListener,   removeMouseTrackListener,   removeMouseWheelListener,   removePaintListener,   removeTraverseListener,   sendFocusEvent,   sendMove,   sendResize,   setBackground,   setBackground,   setBackgroundImage,   setBackgroundImage,   setBackgroundPixel,   setBounds,   setBounds,   setBounds,   setBounds,   setCapture,   setCursor,   setCursor,   setDefaultFont,   setDragDetect,   setEnabled,   setFixedFocus,   setFocus,   setFont,   setForeground,   setForegroundPixel,   setLayoutData,   setLocation,   setLocation,   setMenu,   setParent,   setRadioFocus,   setRadioSelection,   setRedraw,   setRegion,   setSavedFocus,   setSize,   setSize,   setTabItemFocus,   setToolTipText,   setToolTipText,   setVisible,   showWidget,   sort,   subclass,   toControl,   toControl,   toDisplay,   toDisplay,   topHandle,   translateAccelerator,   translateMnemonic,   translateMnemonic,   translateTraversal,   traverse,   traverse,   traverseEscape,   traverseGroup,   traverseItem,   traverseMnemonic,   traversePage,   traverseReturn,   unsubclass,   update,   update,   updateBackgroundColor,   updateBackgroundImage,   updateBackgroundMode,   updateFont,   updateImages,   updateLayout,   widgetCreateStruct,   widgetExtStyle,   widgetParent,   widgetStyle,   windowClass,   windowProc,   windowProc,   wmColorChild,   wmCommandChild,   wmDrawChild,   wmMeasureChild,   wmNotify,   wmNotifyChild,   wmScrollChild
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.Label Detail:
    int lParam) 
    int lParam) 
 LRESULT WM_SIZE(int wParam,
    int lParam) 
    int lParam) 
 int callWindowProc(int hwnd,
    int msg,
    int wParam,
    int lParam) 
 static int checkStyle(int style) 
 public Point computeSize(int wHint,
    int hHint,
    boolean changed) 
  void createHandle() 
 public int getAlignment() 
    Returns a value which describes the position of the text or image in the receiver. The value will be one of LEFT, RIGHT or CENTER unless the receiver is a SEPARATOR label, in which case, NONE is returned.
 public Image getImage() 
    Returns the receiver's image if it has one, or null if it does not.
 String getNameText() 
 public 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.
 boolean mnemonicHit(char key) 
 boolean mnemonicMatch(char key) 
  void releaseWidget() 
 public  void setAlignment(int alignment) 
    Controls how text and images will be displayed in the receiver. The argument should be one of LEFT, RIGHT or CENTER. If the receiver is a SEPARATOR label, the argument is ignored and the alignment is not changed.
 public  void setImage(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) 
    Sets the receiver's 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.

 int widgetExtStyle() 
 int widgetStyle() 
 TCHAR windowClass() 
 int windowProc() 
 LRESULT wmColorChild(int wParam,
    int lParam) 
 LRESULT wmDrawChild(int wParam,
    int lParam)