CookSwt Reference: SWT Component Tags



Support This Project


stats counter


Logo Logo IntelliJ IDEA

Not all attributes of a tag are listed as it is rather a huge task for one person to really write a full documentation for the Swt. Just the ones that I did something special are listed. For the rest, check the Eclipse 3.0 Platform API JavaDoc.

Basically, for a class, any functions (static or non-static) start with "set" prefix and only has one parameter can be used as an attribute which does not have the "set" prefix and in lower case. For example, if you see a setSize(Point size) function, then there is an attribute "size", and the value for the attribute should be a Point object. Similarly for any public variables (static or non-static), there is a corresponding attribute name in lowercase. As always, check the converters page for the available converters that can convert string to the corresponding data type.


  • An internal tag should not be used directly.
  • If a tag is inherited from a tag, then all attributes and adders are inherited from that tag. For example, button inherits control, which in turn inherts widget. Then button inherits the attributes and adders of its ancestors besides the ones it has, which has more prioity.
Tag Class Inherit
browser org.eclipse.swt.widgets.Browser composite  
button org.eclipse.swt.widgets.Button control  
canvas org.eclipse.swt.widgets.Canvas composite  
caret org.eclipse.swt.widgets.Caret widget  
cbanner org.eclipse.swt.widgets.CBanner composite  
ccombo org.eclipse.swt.widgets.CCombo composite Strings can be direct children of this tag to add items to the combo list.
clabel org.eclipse.swt.widgets.CLabel canvas  
colordialog org.eclipse.swt.widgets.ColorDialog dialog  
combo org.eclipse.swt.widgets.Combo composite Strings can be direct children of this tag to add items to the combo list.
composite org.eclipse.swt.widgets.Composite control If a Layout is a direct child, setLayout(Layout) is called to set the composite's layout.
control org.eclipse.swt.widgets.Control widget If a menu is a direct child, then setMenu(Menu) is called to add the menu to the control.
coolbar org.eclipse.swt.widgets.CoolBar composite Whenever the CoolBar is resized, the layout of the Shell containing the CoolBar is adjusted to accommodate the change.
coolitem org.eclipse.swt.widgets.CoolItem item If a control is a direct child, then setControl(Control) is called. Also, the minimum and preferred size of the CoolItem is set to the preferred size of the control.
ctabfolder org.eclipse.swt.widgets.CTabFolder composite  
ctabitem org.eclipse.swt.widgets.CTabItem item If a control is a direct child, then setControl(Control) is called.
decorations org.eclipse.swt.widgets.Decorations canvas If the direct child menu has the BAR style, then setMenuBar(Menu) is called to set the menubar for the Decorations.
dialog org.eclipse.swt.widgets.Dialog    
directorydialog org.eclipse.swt.widgets.DirectoryDialog dialog  
display org.eclipse.swt.widgets.Display   Obtained using Display.getDefault ().
dragsource org.eclipse.swt.widgets.DropSource widget  
droptarget org.eclipse.swt.widgets.DropTarget widget  
expandbar org.eclipse.swt.widgets.ExpandBar composite CookSwt 1.2
expanditem org.eclipse.swt.widgets.ExpandBar item CookSwt 1.2
filedialog org.eclipse.swt.widgets.FileDialog dialog  
fontdialog org.eclipse.swt.widgets.FontDialog dialog  
glcanvas org.eclipse.swt.widgets.GLCanvas canvas CookSwt 1.2
group org.eclipse.swt.widgets.Group composite  
item org.eclipse.swt.widgets.Item listeners Internal tag.
label org.eclipse.swt.widgets.Label control  
link org.eclipse.swt.widgets.Link control CookSwt 1.1
list org.eclipse.swt.widgets.List control Strings can be direct children of this tag to add items to the list.
listeners     Internal tag. It is used to hold all the setters that redirect the setting of "xxxlistener" to addxxxListener(Listener) function calls. A notable exception is DragSourceListener and DropTargetListener which are redirected to addDragListener and addDropListener.
menu org.eclipse.swt.widgets.Menu widget  
menubar org.eclipse.swt.widgets.Menu widget Same as menu, just with a BAR style (additional styles can be specified).
menuitem org.eclipse.swt.widgets.MenuItem item The accelerator of the menu item is basically keys defined in SWT combined together with regular keys. For example: CTRL | SHIFT | T. SWT can also parse the menu text to get the desired accelerator key.
menusplit org.eclipse.swt.widgets.MenuItem item Same as menu, just with a SEPARATOR style (additional styles can be specified).
messagebox org.eclipse.swt.widgets.MessageBox dialog  
printdialog org.eclipse.swt.printing.PrintDialog dialog  
progressbar org.eclipse.swt.widgets.ProgressBar control  
sash org.eclipse.swt.widgets.Sash control  
sashform org.eclipse.swt.widgets.SashForm composite  
scale org.eclipse.swt.widgets.Scale control  
scrolledcomposite org.eclipse.swt.widgets.ScrolledComposite composite  
shell org.eclipse.swt.widgets.Shell decorations  
slider org.eclipse.swt.widgets.Slider control  
spinner org.eclipse.swt.widgets.Spinner composite CookSwt 1.1
styledtext org.eclipse.swt.widgets.StyledText canvas  
systemtray org.eclipse.swt.widgets.Tray widget It is obtained using Display.getCurrent ().getSystemTray ();
tabfolder org.eclipse.swt.widgets.TabFolder composite  
tabitem org.eclipse.swt.widgets.TabItem item If a control is a direct child, then setControl(Control) is called.
table org.eclipse.swt.widgets.Table composite  
tablecolumn org.eclipse.swt.widgets.TableColumn item  
tablecursor org.eclipse.swt.widgets.TableCursor canvas  
tabletree org.eclipse.swt.widgets.TableTree composite Only in CookSwt 1.0.
tabletreeitem org.eclipse.swt.widgets.TableTreeItem item Only in CookSwt 1.0.
textarea org.eclipse.swt.widgets.Text control  
toolbar org.eclipse.swt.widgets.ToolBar composite If the toolbar has WRAP style, then its layout is changed whenever the width becomes too small.
toolitem org.eclipse.swt.widgets.ToolItem item If a control is a direct child, then setControl(Control) is called and the width of the ToolItem is set to the preferred size of the control.
If a menu with DROP_DOWN style is a direct child and this toolitem also has a DROP_DOWN style, then when the arrow is pressed, the drop down menu becomes visible and is located right below the tool item.
tooltip org.eclipse.swt.widgets.ToolTip widget CookSwt 1.2
tracker org.eclipse.swt.widgets.Tracker widget  
trayitem org.eclipse.swt.widgets.TrayItem item  
tree org.eclipse.swt.widgets.Tree composite  
treecolumn org.eclipse.swt.widgets.TreeColumn item CookSwt 1.1
treeitem org.eclipse.swt.widgets.TrayItem item  
viewform org.eclipse.swt.widgets.ViewForm composite  
widget org.eclipse.swt.widgets.Widget listeners Internal tag.
xmldialog XmlDialog dialog  

(c) Copyright 2004-2007 Heng Yuan. All rights reserved.

Valid XHTML 1.0! Valid CSS!