本文整理汇总了Java中com.sun.javafx.scene.control.skin.ComboBoxListViewSkin类的典型用法代码示例。如果您正苦于以下问题:Java ComboBoxListViewSkin类的具体用法?Java ComboBoxListViewSkin怎么用?Java ComboBoxListViewSkin使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
ComboBoxListViewSkin类属于com.sun.javafx.scene.control.skin包,在下文中一共展示了ComboBoxListViewSkin类的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: selectClosestResultBasedOnTextFieldValue
import com.sun.javafx.scene.control.skin.ComboBoxListViewSkin; //导入依赖的package包/类
private void selectClosestResultBasedOnTextFieldValue(boolean affect, boolean inFocus) {
ObservableList items = AutoCompleteComboBoxListener.this.comboBox.getItems();
boolean found = false;
for (int i = 0; i < items.size(); i++) {
if (items.get(i) != null && AutoCompleteComboBoxListener.this.comboBox.getEditor().getText() != null && AutoCompleteComboBoxListener.this.comboBox.getEditor().getText().toLowerCase().equals(items.get(i).toString().toLowerCase())) {
try {
ListView lv = ((ComboBoxListViewSkin) AutoCompleteComboBoxListener.this.comboBox.getSkin()).getListView();
lv.getSelectionModel().clearAndSelect(i);
lv.scrollTo(lv.getSelectionModel().getSelectedIndex());
found = true;
break;
} catch (Exception ignored) {
}
}
}
String s = comboBox.getEditor().getText();
if (!found && affect) {
comboBox.getSelectionModel().clearSelection();
comboBox.getEditor().setText(s);
comboBox.getEditor().end();
}
if (!found) {
comboBox.getEditor().setText(null);
comboBox.getSelectionModel().select(null);
comboBox.setValue(null);
}
if (!inFocus && comboBox.getEditor().getText() != null && comboBox.getEditor().getText().trim().length() > 0) {
// press enter key programmatically to have this entry added
// KeyEvent ke = new KeyEvent(comboBox, KeyCode.ENTER.toString(), KeyCode.ENTER.getName(), KeyCode.ENTER.impl_getCode(), false, false, false, false, KeyEvent.KEY_RELEASED);
KeyEvent ke = new KeyEvent(KeyEvent.KEY_RELEASED, KeyCode.ENTER.toString(), KeyCode.ENTER.toString(), KeyCode.ENTER, false, false, false, false);
comboBox.fireEvent(ke);
}
}
示例2: editorProperty
import com.sun.javafx.scene.control.skin.ComboBoxListViewSkin; //导入依赖的package包/类
public final ReadOnlyObjectProperty<TextField> editorProperty() {
if (editor == null) {
editor = new ReadOnlyObjectWrapper<TextField>(this, "editor");
textField = new ComboBoxListViewSkin.FakeFocusTextField();
editor.set(textField);
}
return editor.getReadOnlyProperty();
}
示例3: selectClosestResultBasedOnTextFieldValue
import com.sun.javafx.scene.control.skin.ComboBoxListViewSkin; //导入依赖的package包/类
private void selectClosestResultBasedOnTextFieldValue(boolean affect, boolean inFocus) {
@SuppressWarnings("rawtypes")
ObservableList items = AutoCompleteComboBoxListener.this.comboBox.getItems();
boolean found = false;
for (int i=0; i<items.size(); i++) {
if (AutoCompleteComboBoxListener.this.comboBox.getEditor().getText().toLowerCase().equals(items.get(i).toString().toLowerCase())) {
try {
@SuppressWarnings("rawtypes")
ListView lv = ((ComboBoxListViewSkin) AutoCompleteComboBoxListener.this.comboBox.getSkin()).getListView();
lv.getSelectionModel().clearAndSelect(i);
lv.scrollTo(lv.getSelectionModel().getSelectedIndex());
found = true;
break;
} catch (Exception e) { }
}
}
String s = comboBox.getEditor().getText();
if (!found && affect) {
comboBox.getSelectionModel().clearSelection();
comboBox.getEditor().setText(s);
comboBox.getEditor().end();
}
if (!inFocus && comboBox.getEditor().getText() != null && comboBox.getEditor().getText().trim().length() > 0) {
// press enter key programmatically to have this entry added
//KeyEvent ke = new KeyEvent(comboBox, comboBox, KeyEvent.KEY_TYPED, "", "", KeyCode.ENTER, false, false, false, false);
//comboBox.fireEvent(ke);
}
}
示例4: getListView
import com.sun.javafx.scene.control.skin.ComboBoxListViewSkin; //导入依赖的package包/类
private ListView getListView() {
return ((ComboBoxListViewSkin) this.comboBox.getSkin())
.getListView();
}
示例5: select
import com.sun.javafx.scene.control.skin.ComboBoxListViewSkin; //导入依赖的package包/类
@SuppressWarnings("rawtypes")
private void select(T item) {
box.getSelectionModel().select(item);
ListView lv = ((ComboBoxListViewSkin) box.getSkin()).getListView();
lv.scrollTo(lv.getSelectionModel().getSelectedIndex());
}