该楼层疑似违规已被系统折叠 隐藏此楼查看此楼
public class HelloWorldCombo {//下拉列表项 private static final String[] ITEMS = { "Alpha", "Bravo", "Charlie", "Delta","Echo", "Foxtrot", "Golf", "Hotel", "India", "Juliet", "Kilo", "Lima", "Mike","November", "Oscar", "Papa", "Quebec", "Romeo", "Sierra", "Tango", "Uniform","Victor", "Whiskey", "X-Ray", "Yankee", "Zulu"};public static void main(String[] args) {Display display = new Display();Shell shell = new Shell(display);shell.setLayout(new RowLayout());//添加下拉按钮样式的下拉列表框 Combo combo = new Combo(shell, SWT.DROP_DOWN);//设置下拉列表项 combo.setItems(ITEMS);//添加只读样式的下拉列表框 Combo readOnly = new Combo(shell, SWT.DROP_DOWN | SWT.READ_ONLY);//设置下拉列表项 readOnly.setItems(ITEMS);//添加无下拉按钮样式的下拉列表框 Combo simple = new Combo(shell, SWT.SIMPLE);//设置下拉列表项 simple.setItems(ITEMS);shell.open();while (!shell.isDisposed()) {if (!display.readAndDispatch()) {display.sleep();}}display.dispose();}}