本文整理匯總了Java中org.eclipse.swt.widgets.Combo.addKeyListener方法的典型用法代碼示例。如果您正苦於以下問題:Java Combo.addKeyListener方法的具體用法?Java Combo.addKeyListener怎麽用?Java Combo.addKeyListener使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類org.eclipse.swt.widgets.Combo
的用法示例。
在下文中一共展示了Combo.addKeyListener方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: createDialogArea
import org.eclipse.swt.widgets.Combo; //導入方法依賴的package包/類
@Override
protected Control createDialogArea(Composite parent) {
Composite composite = (Composite) super.createDialogArea(parent);
boolean isWin32 = Util.isWindows();
GridLayoutFactory.fillDefaults().extendedMargins(isWin32 ? 0 : 3, 3, 2, 2).applyTo(composite);
List<String> list = history.toList();
String[] items = list.toArray(new String[list.size()]);
Combo comboBox = SWTFactory.createCombo(composite, SWT.NONE, 2, items);
Font terminalFont = JFaceResources.getTextFont();
comboBox.setFont(terminalFont);
GridData textLayoutData = new GridData();
textLayoutData.horizontalAlignment = GridData.FILL;
textLayoutData.verticalAlignment = GridData.FILL;
textLayoutData.grabExcessHorizontalSpace = true;
textLayoutData.grabExcessVerticalSpace = false;
textLayoutData.horizontalSpan = 2;
comboBox.setLayoutData(textLayoutData);
comboBox.addKeyListener(new KeyAdapter() {
@Override
public void keyReleased(KeyEvent event) {
if (event.character == '\r' ){
inputText = comboBox.getText();
if (inputText!=null){
if (! inputText.equals(history.current())){
/* when not same as current history entry, add it to history*/
history.add(inputText);
}
}
close();
}
}
});
return composite;
}
示例2: Swt_combo
import org.eclipse.swt.widgets.Combo; //導入方法依賴的package包/類
public Swt_combo(Swt_control owner, Keyval_hash ctorArgs) {
combo = new Combo(owner.Under_composite(), SWT.DROP_DOWN);
core = new Swt_core_cmds(combo);
combo.addKeyListener(new Swt_lnr_key(this));
combo.addMouseListener(new Swt_lnr_mouse(this));
combo.addSelectionListener(new Swt_combo__selection_listener(this));
}