本文整理汇总了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));
}
}
示例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;
}
示例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()));
}
示例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;
}
示例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();
}
示例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();
}
示例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();
}
示例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("")));
}
示例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);
}
示例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());
}
示例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);
}
示例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;
}
示例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;
}
示例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;
}