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


Java ComboBox.getItems方法代码示例

本文整理汇总了Java中javafx.scene.control.ComboBox.getItems方法的典型用法代码示例。如果您正苦于以下问题:Java ComboBox.getItems方法的具体用法?Java ComboBox.getItems怎么用?Java ComboBox.getItems使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在javafx.scene.control.ComboBox的用法示例。


在下文中一共展示了ComboBox.getItems方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: updatePathSizeValues

import javafx.scene.control.ComboBox; //导入方法依赖的package包/类
/**
 * Update a list of available path sizes.
 */
@FXThread
private void updatePathSizeValues() {

    final ComboBox<Integer> pathSizeComboBox = getPatchSizeComboBox();
    final SingleSelectionModel<Integer> selectionModel = pathSizeComboBox.getSelectionModel();
    final Integer current = selectionModel.getSelectedItem();

    final ObservableList<Integer> items = pathSizeComboBox.getItems();
    items.clear();

    final ComboBox<Integer> totalSizeComboBox = getTotalSizeComboBox();
    final Integer naxValue = totalSizeComboBox.getSelectionModel().getSelectedItem();

    for (final Integer value : PATCH_SIZE_VARIANTS) {
        if (value >= naxValue) break;
        items.add(value);
    }

    if (items.contains(current)) {
        selectionModel.select(current);
    } else {
        selectionModel.select(items.get(items.size() - 1));
    }
}
 
开发者ID:JavaSaBr,项目名称:jmonkeybuilder,代码行数:28,代码来源:CreateTerrainDialog.java

示例2: reload

import javafx.scene.control.ComboBox; //导入方法依赖的package包/类
@Override
@FXThread
protected void reload() {
    if (!hasEditObject()) return;

    final Geometry geometry = getEditObject();
    final Mesh mesh = geometry.getMesh();
    if (mesh == null) return;

    final Integer element = getPropertyValue();
    final ComboBox<Integer> levelComboBox = getLevelComboBox();
    final ObservableList<Integer> items = levelComboBox.getItems();
    items.clear();

    final int numLodLevels = mesh.getNumLodLevels();

    for (int i = 0; i < numLodLevels; i++) {
        items.add(i);
    }

    if (items.isEmpty()) {
        items.add(0);
    }

    levelComboBox.getSelectionModel().select(element);
}
 
开发者ID:JavaSaBr,项目名称:jmonkeybuilder,代码行数:27,代码来源:LodLevelPropertyControl.java

示例3: reload

import javafx.scene.control.ComboBox; //导入方法依赖的package包/类
@Override
@FXThread
protected void reload() {

    final SceneChangeConsumer changeConsumer = (SceneChangeConsumer) getChangeConsumer();
    final SceneNode currentModel = changeConsumer.getCurrentModel();
    final SceneLayer sceneLayer = getPropertyValue();

    final ComboBox<SceneLayer> levelComboBox = getLayerComboBox();
    final ObservableList<SceneLayer> items = levelComboBox.getItems();
    items.clear();
    items.add(SceneLayer.NO_LAYER);
    items.addAll(currentModel.getLayers());

    levelComboBox.getSelectionModel().select(sceneLayer == null ? SceneLayer.NO_LAYER : sceneLayer);
}
 
开发者ID:JavaSaBr,项目名称:jmonkeybuilder,代码行数:17,代码来源:LayerModelPropertyControl.java

示例4: reload

import javafx.scene.control.ComboBox; //导入方法依赖的package包/类
/**
 * Reload the material.
 */
@FXThread
private void reload(@NotNull final Material material) {
    setCurrentMaterial(material);
    setIgnoreListeners(true);
    try {

        final MaterialEditor3DState editor3DState = getEditor3DState();
        editor3DState.updateMaterial(material);

        getSettingsTree().fill(new RootMaterialSettings(material));

        final ComboBox<String> materialDefinitionBox = getMaterialDefinitionBox();
        final ObservableList<String> items = materialDefinitionBox.getItems();
        items.clear();
        items.addAll(RESOURCE_MANAGER.getAvailableResources(FileExtensions.JME_MATERIAL_DEFINITION));

        final MaterialDef materialDef = material.getMaterialDef();
        materialDefinitionBox.getSelectionModel().select(materialDef.getAssetName());

    } finally {
        setIgnoreListeners(false);
    }
}
 
开发者ID:JavaSaBr,项目名称:jmonkeybuilder,代码行数:27,代码来源:MaterialFileEditor.java

示例5: getComboBoxItemIndex

import javafx.scene.control.ComboBox; //导入方法依赖的package包/类
public int getComboBoxItemIndex(ComboBox<?> comboBox, String value) {
    ObservableList<?> items = comboBox.getItems();
    for (int i = 0; i < items.size(); i++) {
        String text = getComboBoxText(comboBox, i, true);
        if (text.equals(value)) {
            return i;
        }
    }
    return -1;
}
 
开发者ID:jalian-systems,项目名称:marathonv5,代码行数:11,代码来源:JavaFXElementPropertyAccessor.java

示例6: selectCollectionToRun

import javafx.scene.control.ComboBox; //导入方法依赖的package包/类
public void selectCollectionToRun(String collectionName) throws TimeoutException {
    ComboBox<Collection> comboBox = lookup("#collections-combo-box").query();
    clickOn(comboBox);

    for (Collection collection : comboBox.getItems()) {
        if(collection.getName().equals(collectionName)) {
            interact(() -> comboBox.getSelectionModel().select(collection));
        }
    }
}
 
开发者ID:AntonioGabrielAndrade,项目名称:LIRE-Lab,代码行数:11,代码来源:AppViewObject.java

示例7: AutoCompleteComboBoxListener

import javafx.scene.control.ComboBox; //导入方法依赖的package包/类
public AutoCompleteComboBoxListener(final ComboBox<T> comboBox, final Function<T, String> transform) {
    this.comboBox = comboBox;
    this.transform = transform;

    data = comboBox.getItems();
    comboBox.itemsProperty().addListener((obs, oldv, newv) -> {
        data = newv;
    });

    this.comboBox.setEditable(true);
    this.comboBox.setOnKeyPressed(e -> comboBox.hide());
    this.comboBox.setOnKeyReleased(AutoCompleteComboBoxListener.this);
}
 
开发者ID:mbari-media-management,项目名称:vars-annotation,代码行数:14,代码来源:AutoCompleteComboBoxListener.java

示例8: FilteredComboBoxDecorator

import javafx.scene.control.ComboBox; //导入方法依赖的package包/类
public FilteredComboBoxDecorator(final ComboBox<T> comboBox,
                                 AutoCompleteComparator<T> comparator) {
    this.comboBox = comboBox;
    this.comparator = comparator;

    filteredItems = new FilteredList<>(comboBox.getItems());
    comboBox.setItems(filteredItems);

    Tooltip tooltip = new Tooltip();
    tooltip.getStyleClass().add("tooltip-combobox");
    comboBox.setTooltip(tooltip);
    filter.addListener((observable, oldValue, newValue) -> handleFilterChanged(newValue));
    comboBox.setOnKeyPressed(this::handleOnKeyPressed);
    comboBox.setOnHidden(this::handleOnHiding);

    comboBox.itemsProperty().addListener((obs, oldV, newV) -> {
        if (newV != filteredItems) {
            //log.info("New list of size " + newV.size());
            if (!(newV instanceof FilteredList)) {
                filteredItems = new FilteredList<>(newV);
            }
            else {
                filteredItems = (FilteredList<T>) newV;
            }
            comboBox.setItems(filteredItems);
        }
    });
}
 
开发者ID:mbari-media-management,项目名称:vars-annotation,代码行数:29,代码来源:FilteredComboBoxDecorator.java

示例9: validate

import javafx.scene.control.ComboBox; //导入方法依赖的package包/类
@Override
@FXThread
protected void validate(@NotNull final Label warningLabel, @Nullable final ResourceElement element) {

    final ComboBox<String> comboBox = getTextureParamNameComboBox();
    final ObservableList<String> items = comboBox.getItems();
    items.clear();

    final Path file = element == null ? null : element.getFile();

    if (file != null && !Files.isDirectory(file)) {

        final AssetManager assetManager = EDITOR.getAssetManager();
        final Path assetFile = getAssetFile(file);

        if (assetFile == null) {
            throw new RuntimeException("AssetFile can't be null.");
        }

        final MaterialKey materialKey = new MaterialKey(toAssetPath(assetFile));
        final Material material = assetManager.loadAsset(materialKey);
        final MaterialDef materialDef = material.getMaterialDef();

        final Collection<MatParam> materialParams = materialDef.getMaterialParams();
        materialParams.stream()
                .filter(param -> param.getVarType() == VarType.Texture2D)
                .filter(matParam -> material.getTextureParam(matParam.getName()) != null)
                .forEach(filtred -> items.add(filtred.getName()));

        final SingleSelectionModel<String> selectionModel = comboBox.getSelectionModel();

        if (!items.isEmpty()) {
            selectionModel.select(0);
        } else {
            selectionModel.select(null);
        }
    }

    super.validate(warningLabel, element);
}
 
开发者ID:JavaSaBr,项目名称:jmonkeybuilder,代码行数:41,代码来源:ParticlesAssetEditorDialog.java

示例10: addSpecialInstrumentationItem

import javafx.scene.control.ComboBox; //导入方法依赖的package包/类
public static void addSpecialInstrumentationItem(int id, KeyValuePair sectionType, KeyValuePair specialInstrumentation, int specialInstrumentationCount,
                                                 List<SpecialInstrumentationEntity> specialInstrumentationEntityList, GridPane specialInstrumentationContent,
                                                 ComboBox<KeyValuePair> specialInstrumentationSectionGroupComboBox, NumberField specialInstrumentationNumberField) {
    GridPane tmpPane = new GridPane();

    ComboBox<KeyValuePair> sectionTypeComboBox = new ComboBox<>(specialInstrumentationSectionGroupComboBox.getItems());
    sectionTypeComboBox.getSelectionModel().select(sectionType);
    sectionTypeComboBox.setMaxWidth(100);
    sectionTypeComboBox.setMinWidth(100);
    tmpPane.addColumn(0, sectionTypeComboBox);

    ComboBox<KeyValuePair> specialInstrumentationComboBox = new ComboBox<>(TeamF.client.helper.gui.InstrumentationHelper.getInstrumentTypes((SectionGroupType) sectionTypeComboBox.getSelectionModel().getSelectedItem().getValue()));
    specialInstrumentationComboBox.getSelectionModel().selectFirst();
    specialInstrumentationComboBox.setMaxWidth(100);
    specialInstrumentationComboBox.setMinWidth(100);
    tmpPane.addColumn(1, specialInstrumentationComboBox);

    NumberField tmpNumberField = null;
    try {
        tmpNumberField = new NumberField(specialInstrumentationCount, specialInstrumentationNumberField.getMinValue().intValue(), specialInstrumentationNumberField.getMaxValue().intValue());
        tmpPane.addColumn(2, tmpNumberField);
        tmpNumberField.setMaxWidth(60);
        tmpNumberField.setStyle("-fx-opacity: 1");
    } catch (NumberRangeException e) {
    }

    sectionTypeComboBox.getSelectionModel().selectedItemProperty().addListener((observable, oldValue, newValue) -> {
        if (newValue != null) {
            if(((TeamF.client.helper.gui.InstrumentationHelper.getInstrumentTypes((SectionGroupType) sectionTypeComboBox.getSelectionModel().
                    getSelectedItem().getValue())))!=null) {
                specialInstrumentationComboBox.setItems((TeamF.client.helper.gui.InstrumentationHelper.getInstrumentTypes((SectionGroupType) sectionTypeComboBox.getSelectionModel().
                        getSelectedItem().getValue())));
                specialInstrumentationComboBox.getSelectionModel().selectFirst();
            }
        }
    });

    Button tmpButton = new Button("-");
    tmpPane.addColumn(3, tmpButton);

    specialInstrumentationContent.addRow(specialInstrumentationEntityList.size()+1, tmpPane);
    specialInstrumentationContent.setColumnSpan(tmpPane, 4);
    SpecialInstrumentationEntity specialInstrumentationEntity = new SpecialInstrumentationEntity(id, sectionTypeComboBox, specialInstrumentationComboBox, tmpNumberField, tmpPane);

    tmpButton.setOnAction(e -> removeSpecialInstrumentationItem(specialInstrumentationEntity, specialInstrumentationContent, specialInstrumentationEntityList));

    specialInstrumentationEntityList.add(specialInstrumentationEntity);
}
 
开发者ID:ITB15-S4-GroupD,项目名称:Planchester,代码行数:49,代码来源:InstrumentationHelper.java


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