當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。