import org.eclipse.swt.SWT;
import org.eclipse.swt.custom.ScrolledComposite;
import org.eclipse.swt.layout.FillLayout;
import org.eclipse.swt.widgets.Button;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Shell;
public class MainClass {
public static void main(String[] a) {
final Display d = new Display();
final Shell shell = new Shell(d);
shell.setSize(250, 200);
shell.setLayout(new FillLayout());
ScrolledComposite sc = new ScrolledComposite(shell, SWT.H_SCROLL
| SWT.V_SCROLL);
Composite child = new Composite(sc, SWT.NONE);
child.setLayout(new FillLayout());
new Button(child, SWT.PUSH).setText("One");
new Button(child, SWT.PUSH).setText("Two");
sc.setContent(child);
sc.setMinSize(300, 300);
sc.setExpandHorizontal(true);
sc.setExpandVertical(true);
shell.open();
while (!shell.isDisposed()) {
if (!d.readAndDispatch())
d.sleep();
}
d.dispose();
}
}
|