swt

Topics related to swt:

Getting started with swt

This section provides an overview of what swt is, and why a developer might want to use it.

It should also mention any large subjects within swt, and link out to the related topics. Since the Documentation for swt is new, you may need to create initial versions of those related topics.

GridLayout

When using a GridLayout on a Composite (or a subclass of Composite), child controls should set their layout data to a unique instance of GridData to dictate how the child should be displayed within the parent:

// ...
final Shell shell = new Shell(display);
shell.setLayout(new GridLayout());

final Composite child = new Composite(shell, SWT.NONE);
child.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
// ...

Failure to set a GridData object on child controls may result in the child not being positioned as desired. Furthermore, if the child is a Composite (or a subclass of Composite), the child and its children may not be visible at all.

If the wrong layout data is used (eg. FormData instead of GridData), the result will be a ClassCastException at runtime:

Exception in thread "main" java.lang.ClassCastException: org.eclipse.swt.layout.FormData cannot be cast to org.eclipse.swt.layout.GridData

ExpandBar

Per the Eclipse documentation, the ExpandBar class is not intended to be subclassed.