当前位置: 首页>>代码示例>>Java>>正文


Java ComboBoxListViewSkin类代码示例

本文整理汇总了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);
            }
        }
 
开发者ID:innFactory,项目名称:JFXC,代码行数:37,代码来源:AutoCompleteComboBox.java

示例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();
}
 
开发者ID:mars-sim,项目名称:mars-sim,代码行数:9,代码来源:Spinner.java

示例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);
    }
}
 
开发者ID:rulz88,项目名称:SAST,代码行数:31,代码来源:AutoCompleteComboBoxListener.java

示例4: getListView

import com.sun.javafx.scene.control.skin.ComboBoxListViewSkin; //导入依赖的package包/类
private ListView getListView() {
    return ((ComboBoxListViewSkin) this.comboBox.getSkin())
            .getListView();
}
 
开发者ID:gdi-by,项目名称:downloadclient,代码行数:5,代码来源:AutoCompleteComboBoxListener.java

示例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());
}
 
开发者ID:demilich1,项目名称:metastone,代码行数:7,代码来源:ComboBoxKeyHandler.java


注:本文中的com.sun.javafx.scene.control.skin.ComboBoxListViewSkin类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。