Home » Eclipse-SWT-3.5.1 » org.eclipse.swt.widgets » [javadoc | source]
org.eclipse.swt.widgets
public class: Composite [javadoc | source]
java.lang.Object
   org.eclipse.swt.widgets.Widget
      org.eclipse.swt.widgets.Control
         org.eclipse.swt.widgets.Scrollable
            org.eclipse.swt.widgets.Composite

All Implemented Interfaces:
    Drawable

Instances of this class are controls which are capable of containing other controls.
Styles:
NO_BACKGROUND, NO_FOCUS, NO_MERGE_PAINTS, NO_REDRAW_RESIZE, NO_RADIO_GROUP, EMBEDDED, DOUBLE_BUFFERED
Events:
(none)

Note: The NO_BACKGROUND, NO_FOCUS, NO_MERGE_PAINTS, and NO_REDRAW_RESIZE styles are intended for use with Canvas. They can be used with Composite if you are drawing your own, but their behavior is undefined if they are used with subclasses of Composite other than Canvas.

Note: The CENTER style, although undefined for composites, has the same value as EMBEDDED which is used to embed widgets from other widget toolkits into SWT. On some operating systems (GTK, Motif), this may cause the children of this composite to be obscured.

This class may be subclassed by custom control implementors who are building controls that are constructed from aggregates of other controls.

Field Summary
 Layout layout     
 WINDOWPOS[] lpwp     
 Control[] tabList     
 int layoutCount     
 int backgroundMode     
Fields inherited from org.eclipse.swt.widgets.Scrollable:
horizontalBar,  verticalBar
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:
style,  state,  display,  eventTable,  data,  DISPOSED,  CANVAS,  KEYED_DATA,  DISABLED,  HIDDEN,  LAYOUT_NEEDED,  LAYOUT_CHANGED,  LAYOUT_CHILD,  THEME_BACKGROUND,  DRAW_BACKGROUND,  PARENT_BACKGROUND,  RELEASED,  DISPOSE_SENT,  TRACK_MOUSE,  FOREIGN_HANDLE,  DRAG_DETECT,  MOVE_OCCURRED,  MOVE_DEFERRED,  RESIZE_OCCURRED,  RESIZE_DEFERRED,  IGNORE_WM_CHANGEUISTATE,  DEFAULT_WIDTH,  DEFAULT_HEIGHT,  MAJOR,  MINOR
Constructor:
 Composite() 
 public Composite(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.

    Parameters:
    parent - a widget which will be the parent of the new instance (cannot be null)
    style - the style of widget to construct
    Throws:
    IllegalArgumentException -
    • ERROR_NULL_ARGUMENT - if the parent is null

    SWTException -
    • ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the parent

    Also see:
    SWT#NO_BACKGROUND
    SWT#NO_FOCUS
    SWT#NO_MERGE_PAINTS
    SWT#NO_REDRAW_RESIZE
    SWT#NO_RADIO_GROUP
    SWT#EMBEDDED
    SWT#DOUBLE_BUFFERED
    Widget#getStyle
    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

Method from org.eclipse.swt.widgets.Composite Summary:
WM_ERASEBKGND,   WM_GETDLGCODE,   WM_GETFONT,   WM_LBUTTONDOWN,   WM_NCHITTEST,   WM_PAINT,   WM_PARENTNOTIFY,   WM_PRINTCLIENT,   WM_SETFONT,   WM_SIZE,   WM_SYSCOLORCHANGE,   WM_SYSCOMMAND,   WM_UPDATEUISTATE,   _getChildren,   _getTabList,   changed,   checkBuffered,   checkComposited,   checkSubclass,   computeSize,   computeTabList,   copyArea,   createHandle,   findDeferredControl,   findMenus,   fixChildren,   fixTabList,   getBackgroundMode,   getChildren,   getChildrenCount,   getLayout,   getLayoutDeferred,   getTabList,   hooksKeys,   isLayoutDeferred,   layout,   layout,   layout,   layout,   markLayout,   minimumSize,   redrawChildren,   releaseChildren,   releaseParent,   releaseWidget,   removeControl,   resizeChildren,   resizeChildren,   resizeEmbeddedHandle,   sendResize,   setBackgroundMode,   setBounds,   setFixedFocus,   setFocus,   setLayout,   setLayoutDeferred,   setResizeChildren,   setTabGroupFocus,   setTabList,   toolTipText,   translateMnemonic,   translateTraversal,   updateBackgroundColor,   updateBackgroundImage,   updateBackgroundMode,   updateFont,   updateLayout,   updateUIState,   widgetStyle,   wmNCPaint,   wmNotify
Methods from org.eclipse.swt.widgets.Scrollable:
WM_HSCROLL,   WM_MOUSEWHEEL,   WM_SIZE,   WM_VSCROLL,   callWindowProc,   computeTrim,   createScrollBar,   createWidget,   destroyScrollBar,   getClientArea,   getHorizontalBar,   getVerticalBar,   releaseChildren,   scrolledHandle,   widgetExtStyle,   widgetStyle,   windowClass,   windowProc,   wmNCPaint,   wmScroll,   wmScrollWheel
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.Composite Detail:
 LRESULT WM_ERASEBKGND(int wParam,
    int lParam) 
 LRESULT WM_GETDLGCODE(int wParam,
    int lParam) 
 LRESULT WM_GETFONT(int wParam,
    int lParam) 
 LRESULT WM_LBUTTONDOWN(int wParam,
    int lParam) 
 LRESULT WM_NCHITTEST(int wParam,
    int lParam) 
 LRESULT WM_PAINT(int wParam,
    int lParam) 
 LRESULT WM_PARENTNOTIFY(int wParam,
    int lParam) 
 LRESULT WM_PRINTCLIENT(int wParam,
    int lParam) 
 LRESULT WM_SETFONT(int wParam,
    int lParam) 
 LRESULT WM_SIZE(int wParam,
    int lParam) 
 LRESULT WM_SYSCOLORCHANGE(int wParam,
    int lParam) 
 LRESULT WM_SYSCOMMAND(int wParam,
    int lParam) 
 LRESULT WM_UPDATEUISTATE(int wParam,
    int lParam) 
 Control[] _getChildren() 
 Control[] _getTabList() 
 public  void changed(Control[] changed) 
    Clears any data that has been cached by a Layout for all widgets that are in the parent hierarchy of the changed control up to and including the receiver. If an ancestor does not have a layout, it is skipped.
  void checkBuffered() 
  void checkComposited() 
 protected  void checkSubclass() 
 public Point computeSize(int wHint,
    int hHint,
    boolean changed) 
 Widget[] computeTabList() 
  void copyArea(GC gc,
    int x,
    int y,
    int width,
    int height) 
    Copies a rectangular area of the receiver at the specified position using the gc.
  void createHandle() 
 Composite findDeferredControl() 
 Menu[] findMenus(Control control) 
  void fixChildren(Shell newShell,
    Shell oldShell,
    Decorations newDecorations,
    Decorations oldDecorations,
    Menu[] menus) 
  void fixTabList(Control control) 
 public int getBackgroundMode() 
    Returns the receiver's background drawing mode. This will be one of the following constants defined in class SWT: INHERIT_NONE, INHERIT_DEFAULT, INHERTIT_FORCE.
 public Control[] getChildren() 
    Returns a (possibly empty) array containing the receiver's children. Children are returned in the order that they are drawn. The topmost control appears at the beginning of the array. Subsequent controls draw beneath this control and appear later in the array.

    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.

 int getChildrenCount() 
 public Layout getLayout() 
    Returns layout which is associated with the receiver, or null if one has not been set.
 public boolean getLayoutDeferred() 
    Returns true if the receiver has deferred the performing of layout, and false otherwise.
 public Control[] getTabList() 
    Gets the (possibly empty) tabbing order for the control.
 boolean hooksKeys() 
 public boolean isLayoutDeferred() 
    Returns true if the receiver or any ancestor up to and including the receiver's nearest ancestor shell has deferred the performing of layouts. Otherwise, false is returned.
 public  void layout() 
    If the receiver has a layout, asks the layout to lay out (that is, set the size and location of) the receiver's children. If the receiver does not have a layout, do nothing.

    This is equivalent to calling layout(true).

    Note: Layout is different from painting. If a child is moved or resized such that an area in the parent is exposed, then the parent will paint. If no child is affected, the parent will not paint.

 public  void layout(boolean changed) 
    If the receiver has a layout, asks the layout to lay out (that is, set the size and location of) the receiver's children. If the argument is true the layout must not rely on any information it has cached about the immediate children. If it is false the layout may (potentially) optimize the work it is doing by assuming that none of the receiver's children has changed state since the last layout. If the receiver does not have a layout, do nothing.

    If a child is resized as a result of a call to layout, the resize event will invoke the layout of the child. The layout will cascade down through all child widgets in the receiver's widget tree until a child is encountered that does not resize. Note that a layout due to a resize will not flush any cached information (same as layout(false)).

    Note: Layout is different from painting. If a child is moved or resized such that an area in the parent is exposed, then the parent will paint. If no child is affected, the parent will not paint.

 public  void layout(Control[] changed) 
    Forces a lay out (that is, sets the size and location) of all widgets that are in the parent hierarchy of the changed control up to and including the receiver. The layouts in the hierarchy must not rely on any information cached about the changed control or any of its ancestors. The layout may (potentially) optimize the work it is doing by assuming that none of the peers of the changed control have changed state since the last layout. If an ancestor does not have a layout, skip it.

    Note: Layout is different from painting. If a child is moved or resized such that an area in the parent is exposed, then the parent will paint. If no child is affected, the parent will not paint.

 public  void layout(boolean changed,
    boolean all) 
    If the receiver has a layout, asks the layout to lay out (that is, set the size and location of) the receiver's children. If the changed argument is true the layout must not rely on any information it has cached about its children. If it is false the layout may (potentially) optimize the work it is doing by assuming that none of the receiver's children has changed state since the last layout. If the all argument is true the layout will cascade down through all child widgets in the receiver's widget tree, regardless of whether the child has changed size. The changed argument is applied to all layouts. If the all argument is false, the layout will not cascade down through all child widgets in the receiver's widget tree. However, if a child is resized as a result of a call to layout, the resize event will invoke the layout of the child. Note that a layout due to a resize will not flush any cached information (same as layout(false)).

    Note: Layout is different from painting. If a child is moved or resized such that an area in the parent is exposed, then the parent will paint. If no child is affected, the parent will not paint.

  void markLayout(boolean changed,
    boolean all) 
 Point minimumSize(int wHint,
    int hHint,
    boolean changed) 
 boolean redrawChildren() 
  void releaseChildren(boolean destroy) 
  void releaseParent() 
  void releaseWidget() 
  void removeControl(Control control) 
  void resizeChildren() 
 boolean resizeChildren(boolean defer,
    WINDOWPOS[] pwp) 
  void resizeEmbeddedHandle(int embeddedHandle,
    int width,
    int height) 
  void sendResize() 
 public  void setBackgroundMode(int mode) 
    Sets the background drawing mode to the argument which should be one of the following constants defined in class SWT: INHERIT_NONE, INHERIT_DEFAULT, INHERIT_FORCE.
  void setBounds(int x,
    int y,
    int width,
    int height,
    int flags,
    boolean defer) 
 boolean setFixedFocus() 
 public boolean setFocus() 
 public  void setLayout(Layout layout) 
    Sets the layout which is associated with the receiver to be the argument which may be null.
 public  void setLayoutDeferred(boolean defer) 
    If the argument is true, causes subsequent layout operations in the receiver or any of its children to be ignored. No layout of any kind can occur in the receiver or any of its children until the flag is set to false. Layout operations that occurred while the flag was true are remembered and when the flag is set to false, the layout operations are performed in an optimized manner. Nested calls to this method are stacked.
  void setResizeChildren(boolean resize) 
 boolean setTabGroupFocus() 
 public  void setTabList(Control[] tabList) 
    Sets the tabbing order for the specified controls to match the order that they occur in the argument list.
 String toolTipText(NMTTDISPINFO hdr) 
 boolean translateMnemonic(Event event,
    Control control) 
 boolean translateTraversal(MSG msg) 
  void updateBackgroundColor() 
  void updateBackgroundImage() 
  void updateBackgroundMode() 
  void updateFont(Font oldFont,
    Font newFont) 
  void updateLayout(boolean resize,
    boolean all) 
  void updateUIState() 
 int widgetStyle() 
 LRESULT wmNCPaint(int hwnd,
    int wParam,
    int lParam) 
 LRESULT wmNotify(NMHDR hdr,
    int wParam,
    int lParam)