1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32
|
import org.eclipse.swt.SWT;
import org.eclipse.swt.layout.GridLayout;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.List;
import org.eclipse.swt.widgets.Shell;
public class testframe {
public static void main(String[] args) {
Display display = new Display();
Shell shell = new Shell(display);
shell.setText("List Example");
shell.setLayout(new GridLayout());
Composite cmp = new Composite(shell, SWT.TRANSPARENT);
GridLayout layout = new GridLayout(2, false);
cmp.setLayout(layout);
List list = new List(cmp, SWT.SINGLE | SWT.BORDER | SWT.V_SCROLL);
list.setBounds(40, 20, 220, 100);
for (int i = 0; i < 1000; i++)
list.add("Item Number" + i);
shell.open();
while (!shell.isDisposed()) {
if (!display.readAndDispatch())
display.sleep();
}
display.dispose();
}
} |
Partager