本文整理匯總了Java中org.eclipse.swt.widgets.Combo.setFocus方法的典型用法代碼示例。如果您正苦於以下問題:Java Combo.setFocus方法的具體用法?Java Combo.setFocus怎麽用?Java Combo.setFocus使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類org.eclipse.swt.widgets.Combo
的用法示例。
在下文中一共展示了Combo.setFocus方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: controlChanged
import org.eclipse.swt.widgets.Combo; //導入方法依賴的package包/類
public void controlChanged(Control control) {
sectionChanged(control);
if (control instanceof Text) {
Text t = ((Text) control);
t.setFocus();
t.setSelection(t.getText().length());
} else if (control instanceof Combo) {
Combo combo = (Combo) control;
combo.setFocus();
} else {
control.setFocus();
}
}
示例2: createControl
import org.eclipse.swt.widgets.Combo; //導入方法依賴的package包/類
@Override
public void createControl(final Composite parent) {
final Composite composite = new Composite(parent, SWT.NULL);
final GridLayout layout = new GridLayout();
layout.numColumns = 2;
composite.setLayout(layout);
final Label label = new Label(composite, SWT.NULL);
label.setText(ResourceString.getResourceString("label.database"));
databaseCombo = new Combo(composite, SWT.BORDER | SWT.READ_ONLY);
final GridData dbData = new GridData(GridData.FILL_HORIZONTAL);
dbData.widthHint = 200;
databaseCombo.setLayoutData(dbData);
databaseCombo.setVisibleItemCount(10);
for (final String db : DBManagerFactory.getAllDBList()) {
databaseCombo.add(db);
}
databaseCombo.addModifyListener(new ModifyListener() {
@Override
public void modifyText(final ModifyEvent e) {
validatePage();
}
});
databaseCombo.setFocus();
validatePage();
setControl(composite);
}