import org.eclipse.swt.SWT;
import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.List;
import org.eclipse.swt.widgets.Shell;
public class ListTest {
private static List list_4;
private static List list_3;
private static List list_2;
private static List list_1;
private static List list;
/**
* Launch the application
* @param args
*/
public static void main(String[] args) {
final Display display = Display.getDefault();
final Shell shell = new Shell();
shell.setSize(500, 375);
shell.setText("SWT Application");
//
shell.open();
list = new List(shell, SWT.NONE);
list.setBounds(86, 10, 100, 100);
for(int i=1;i<=10;i++)
list.add("第"+i+"项");
list_1 = new List(shell, SWT.BORDER);//带边框
list_1.setBounds(311, 10, 100, 100);
for(int i=1;i<=10;i++)
list_1.add("第"+i+"项");
list_2 = new List(shell, SWT.V_SCROLL);
list_2.setBounds(86, 127, 100, 100);
for(int i=1;i<=10;i++)
list_2.add("第"+i+"项");
list_3 = new List(shell, SWT.H_SCROLL);
list_3.setBounds(311, 127, 100, 100);
for(int i=1;i<=10;i++)
list_3.add("第"+i+"项fffffffff ");
list_4 = new List(shell, SWT.MULTI);
list_4.setBounds(86, 244, 100, 100);
for(int i=1;i<=10;i++)
list_4.add("第"+i+"项");
shell.layout();
while (!shell.isDisposed()) {
if (!display.readAndDispatch())
display.sleep();
}
}
}
posted on 2008-03-31 07:10
hakuci 阅读(229)
评论(0) 编辑 收藏