public void createPartControl(Composite parent) { toolkit = new FormToolkit(parent.getDisplay());
form = toolkit.createScrolledForm(parent);
form.setText("Hello, Eclipse Forms");
Composite body = form.getBody();
TableWrapLayout layout = new TableWrapLayout();
body.setLayout(layout);
HyPerlink link = toolkit.createHyperlink(body,
"Click here.", SWT.WRAP);
link.addHyperlinkListener(new HyperlinkAdapter()
{public void linkActivated(HyperlinkEvent e)
{ System.out.println("Link activated!");} });
layout.numColumns = 2;
link.setText ("This is an example of a form that is much longer and
will need to wrap."); TableWrapData td = new TableWrapData();
td.colspan = 2; link.setLayoutData(td);
Label label = toolkit.createLabel(body, "Text field label:");
Text text = toolkit.createText(body, "");
td = new TableWrapData(TableWrapData.FILL_GRAB);
text.setLayoutData(td);
text.setData(FormToolkit.KEY_DRAW_BORDER,
FormToolkit.TEXT_BORDER); Button button =
toolkit.createButton(body,
"An example of a checkbox in a form", SWT.CHECK);
td = new TableWrapData();
td.colspan = 2; button.setLayoutData(td);
toolkit.paintBordersFor(body);}