本文整理匯總了Java中org.eclipse.swt.widgets.Combo.setSelection方法的典型用法代碼示例。如果您正苦於以下問題:Java Combo.setSelection方法的具體用法?Java Combo.setSelection怎麽用?Java Combo.setSelection使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類org.eclipse.swt.widgets.Combo
的用法示例。
在下文中一共展示了Combo.setSelection方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: set
import org.eclipse.swt.widgets.Combo; //導入方法依賴的package包/類
public static void set(Combo combo, String str) {
String strToSet = str==null ? "" : str;
if (!combo.getText().equals(strToSet)) {
combo.setText(strToSet);
combo.setSelection(new Point(strToSet.length(), strToSet.length()));
}
// combo.setText(str==null?"":str);
}
示例2: addDecoration
import org.eclipse.swt.widgets.Combo; //導入方法依賴的package包/類
public static void addDecoration(
final Field workItemField,
final Widget widget,
final String modifyListenerWidgetDataKey) {
if (needToAddDecoration(workItemField, widget)) {
ModifyListener modifyListener = null;
if (modifyListenerWidgetDataKey != null) {
modifyListener = (ModifyListener) widget.getData(modifyListenerWidgetDataKey);
}
if (widget instanceof Text) {
final Text text = (Text) widget;
if (modifyListener != null) {
text.removeModifyListener(modifyListener);
}
text.setText(DECORATION_TEXT);
text.setSelection(new Point(0, DECORATION_TEXT.length()));
if (modifyListener != null) {
text.addModifyListener(modifyListener);
}
} else {
final Combo combo = (Combo) widget;
if (modifyListener != null) {
combo.removeModifyListener(modifyListener);
}
combo.setText(DECORATION_TEXT);
combo.setSelection(new Point(0, DECORATION_TEXT.length()));
if (modifyListener != null) {
combo.addModifyListener(modifyListener);
}
}
setHasDecoration(widget, true);
}
}