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


Java ComboBox.getSelectionModel方法代码示例

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


在下文中一共展示了ComboBox.getSelectionModel方法的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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: editorModeSelection

import javafx.scene.control.ComboBox; //导入方法依赖的package包/类
private Node editorModeSelection( EditorSettingDetails settingDetails, ObservableList<String> editorModes )
{
	HBox hBox = new HBox();

	Text editorModeLabel = new Text("Editor Mode: ");
	editorModeLabel.setId(UIConstants.TEXT_COLOR);

	ComboBox<String> editorModeComboBox = new ComboBox<>(editorModes);
	editorModeComboBox.getSelectionModel().select(settingDetails.getEditorMode());

	editorModeSelectionModel = editorModeComboBox.getSelectionModel();

	hBox.getChildren().addAll(editorModeLabel, editorModeComboBox);
	hBox.setAlignment(Pos.CENTER_LEFT);

	return hBox;
}
 
开发者ID:dhawal9035,项目名称:WebPLP,代码行数:18,代码来源:EditorSettingsPanel.java

示例3: processOpen

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

    final ComboBox<String> textureParamNameBox = getTextureParamNameComboBox();
    final SingleSelectionModel<String> selectionModel = textureParamNameBox.getSelectionModel();
    final String textureParamName = selectionModel.getSelectedItem();

    final CheckBox transformBox = getApplyLightingTransformCheckBox();

    final AssetManager assetManager = EDITOR.getAssetManager();

    final Path file = element.getFile();
    final Path assetFile = getAssetFile(file);

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

    final Material material = assetManager.loadAsset(new MaterialKey(toAssetPath(assetFile)));

    final Consumer<ParticlesMaterial> consumer = getConsumer();
    consumer.accept(new ParticlesMaterial(material, textureParamName, transformBox.isSelected()));
}
 
开发者ID:JavaSaBr,项目名称:jmonkeybuilder,代码行数:26,代码来源:ParticlesAssetEditorDialog.java

示例4: fontSizeSelection

import javafx.scene.control.ComboBox; //导入方法依赖的package包/类
private Node fontSizeSelection( EditorSettingDetails settingDetails )
{
	HBox hBox = new HBox();

	Text fontSizeLabel = new Text("Font Size: ");
	fontSizeLabel.setId(UIConstants.TEXT_COLOR);

	List<String> fontSizes = Arrays.asList("6", "8", "12", "14", "16", "20", "32", "48", "60", "72");

	ObservableList<String> fontSizeList = FXCollections.observableArrayList(fontSizes);

	ComboBox<String> fontSizesComboBox = new ComboBox<>(fontSizeList);
	fontSizesComboBox.setEditable(true);
	fontSizesComboBox.editorProperty().getValue().textProperty().addListener(( observable, oldValue, newValue )
																					 -> {
		if ( !newValue.isEmpty() )
			UIStyle.applyError(VerifyUtil.simpleIntegerCheck(newValue), fontSizesComboBox);
	});

	fontSizesComboBox.getSelectionModel().select(settingDetails.getFontSize());
	fontSizesComboBox.autosize();

	fontSizeSelectionModel = fontSizesComboBox.getSelectionModel();

	hBox.getChildren().addAll(fontSizeLabel, fontSizesComboBox);
	hBox.setAlignment(Pos.CENTER_LEFT);

	return hBox;
}
 
开发者ID:dhawal9035,项目名称:WebPLP,代码行数:30,代码来源:EditorSettingsPanel.java

示例5: changeImpl

import javafx.scene.control.ComboBox; //导入方法依赖的package包/类
@Override
@FXThread
protected void changeImpl() {
    final ComboBox<String> comboBox = getComboBox();
    final SingleSelectionModel<String> selectionModel = comboBox.getSelectionModel();
    setPropertyValue(selectionModel.getSelectedItem());
    super.changeImpl();
}
 
开发者ID:JavaSaBr,项目名称:jmonkeybuilder,代码行数:9,代码来源:StringFromListPropertyEditorControl.java

示例6: changeImpl

import javafx.scene.control.ComboBox; //导入方法依赖的package包/类
@Override
@FXThread
protected void changeImpl() {
    final ComboBox<Font> comboBox = getComboBox();
    final SingleSelectionModel<Font> selectionModel = comboBox.getSelectionModel();
    setPropertyValue(selectionModel.getSelectedItem());
    super.changeImpl();
}
 
开发者ID:JavaSaBr,项目名称:jmonkeybuilder,代码行数:9,代码来源:AwtFontPropertyEditorControl.java

示例7: changeImpl

import javafx.scene.control.ComboBox; //导入方法依赖的package包/类
@Override
@FXThread
protected void changeImpl() {
    final ComboBox<T> enumComboBox = getEnumComboBox();
    final SingleSelectionModel<T> selectionModel = enumComboBox.getSelectionModel();
    setPropertyValue(selectionModel.getSelectedItem());
    super.changeImpl();
}
 
开发者ID:JavaSaBr,项目名称:jmonkeybuilder,代码行数:9,代码来源:EnumPropertyEditorControl.java

示例8: buildAdditionalDisableCondition

import javafx.scene.control.ComboBox; //导入方法依赖的package包/类
@Override
@FXThread
protected @NotNull ObservableBooleanValue buildAdditionalDisableCondition() {
    final ComboBox<String> comboBox = getTextureParamNameComboBox();
    final SingleSelectionModel<String> selectionModel = comboBox.getSelectionModel();
    final ReadOnlyObjectProperty<String> itemProperty = selectionModel.selectedItemProperty();
    final ObservableBooleanValue parent = super.buildAdditionalDisableCondition();
    return Bindings.and(parent, itemProperty.isNull().or(itemProperty.isEqualTo("")));
}
 
开发者ID:JavaSaBr,项目名称:jmonkeybuilder,代码行数:10,代码来源:ParticlesAssetEditorDialog.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: change

import javafx.scene.control.ComboBox; //导入方法依赖的package包/类
/**
 * Update selected {@link Enum} value.
 */
@FXThread
private void change() {
    if (isIgnoreListener()) return;

    final ComboBox<E> enumComboBox = getEnumComboBox();
    final SingleSelectionModel<E> selectionModel = enumComboBox.getSelectionModel();
    final E newValue = selectionModel.getSelectedItem();

    changed(newValue, getPropertyValue());
}
 
开发者ID:JavaSaBr,项目名称:jmonkeybuilder,代码行数:14,代码来源:EnumPropertyControl.java

示例11: reload

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

    final E element = getPropertyValue();

    final ComboBox<E> enumComboBox = getEnumComboBox();
    final SingleSelectionModel<E> selectionModel = enumComboBox.getSelectionModel();
    selectionModel.select(element);
}
 
开发者ID:JavaSaBr,项目名称:jmonkeybuilder,代码行数:11,代码来源:EnumPropertyControl.java

示例12: applicationThemeSelection

import javafx.scene.control.ComboBox; //导入方法依赖的package包/类
private HBox applicationThemeSelection( ApplicationSettingDetails details,
		ObservableList<String> applicationThemes )
{
	HBox hbox = new HBox();

	Text themeLabel = new Text("Application Theme: ");
	themeLabel.setId(UIConstants.TEXT_COLOR);

	ObservableList<String> list = applicationThemes;

	ComboBox<String> themes = new ComboBox<>(list);
	themes.getSelectionModel().select(details.getApplicationTheme());

	applicationThemeSelectionModel = themes.getSelectionModel();


	hbox.getChildren().addAll(themeLabel, themes);
	hbox.setAlignment(Pos.CENTER_LEFT);

	return hbox;
}
 
开发者ID:dhawal9035,项目名称:WebPLP,代码行数:22,代码来源:ApplicationSettingsPanel.java

示例13: editorThemeSelection

import javafx.scene.control.ComboBox; //导入方法依赖的package包/类
private HBox editorThemeSelection( ApplicationSettingDetails details, ObservableList<String> editorsThemes )
{
	HBox hbox = new HBox();

	Text themeLabel = new Text("Editor Theme: ");
	themeLabel.setId(UIConstants.TEXT_COLOR);

	ObservableList<String> list = editorsThemes;

	ComboBox<String> themes = new ComboBox<>(list);
	themes.getSelectionModel().select(0);

	editorThemeSelectionModel = themes.getSelectionModel();

	hbox.getChildren().addAll(themeLabel, themes);
	hbox.setAlignment(Pos.CENTER_LEFT);

	return hbox;
}
 
开发者ID:dhawal9035,项目名称:WebPLP,代码行数:20,代码来源:ApplicationSettingsPanel.java

示例14: fontListSelection

import javafx.scene.control.ComboBox; //导入方法依赖的package包/类
private Node fontListSelection( EditorSettingDetails settingDetails, ObservableList<String> fontList )
{
	HBox hBox = new HBox();

	Text fontLabel = new Text("Font: ");
	fontLabel.setId(UIConstants.TEXT_COLOR);

	ComboBox<String> fonts = new ComboBox<>(fontList);
	fonts.getSelectionModel().select(settingDetails.getFontName());

	fontSelectionModel = fonts.getSelectionModel();


	hBox.getChildren().addAll(fontLabel, fonts);
	hBox.setAlignment(Pos.CENTER_LEFT);

	return hBox;
}
 
开发者ID:dhawal9035,项目名称:WebPLP,代码行数:19,代码来源:EditorSettingsPanel.java


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