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
| Display display = new Display();
Shell shell = new Shell(display);
final Combo combo = new Combo(shell, SWT.DROP_DOWN);
combo.setItems(new String[] { "A", "B", "C" });
combo.setSize(200, 200);
combo.setText("TEST");
combo.addKeyListener(new KeyAdapter() {
/**
* {@inheritDoc}
*/
@Override
public void keyPressed(final KeyEvent e) {
e.doit = false;
}
});
shell.pack();
shell.open();
while (!shell.isDisposed()) {
if (!display.readAndDispatch()) {
display.sleep();
}
}
display.dispose(); |