import org.eclipse.swt.SWT;
import org.eclipse.swt.layout.FillLayout;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Shell;
import org.eclipse.swt.widgets.Text;
public class MainClass {
public static void main(String[] a) {
Display d = new Display();
Shell s = new Shell(d);
s.setText("A Shell Composite Example");
s.setLayout(new FillLayout());
TextPaneComposite tpc = new TextPaneComposite(s);
s.open();
while (!s.isDisposed()) {
if (!d.readAndDispatch())
d.sleep();
}
d.dispose();
}
}
class TextPaneComposite extends Composite {
public TextPaneComposite(Composite parent) {
super(parent, SWT.BORDER);
this.setLayout(new FillLayout());
Text t = new Text(this, SWT.MULTI | SWT.BORDER | SWT.WRAP | SWT.V_SCROLL);
}
}
|