@Override protected Node createUndecoratedEditor() { final ChoiceBox<T> box = new ChoiceBox<>(alternatives); final T val = currentValue.getValue(); if (alternatives.contains(val)) { box.setValue(val); } else { box.setValue(alternatives.get(0)); } currentValue.bindBidirectional(box.valueProperty()); return box; } }
@Override protected Node createUndecoratedEditor() { final ChoiceBox<T> box = new ChoiceBox<>(alternatives); final T val = currentValue.getValue(); if (alternatives.contains(val)) { box.setValue(val); } else { box.setValue(alternatives.get(0)); } currentValue.bindBidirectional(box.valueProperty()); return box; } }
private <T> void keyPressed(KeyEvent event) { KeyCode code = event.getCode(); if (code.isLetterKey() || code.isDigitKey() || code == KeyCode.SPACE) { String letter = code.getChar(); if (event.getSource() instanceof ComboBox) { ComboBox<T> comboBox = (ComboBox<T>) event.getSource(); T item = getEntryWithKey(letter, comboBox.getConverter(), comboBox.getItems(), comboBox); if (item != null) { comboBox.setValue(item); } } else if (event.getSource() instanceof ChoiceBox) { ChoiceBox<T> choiceBox = (ChoiceBox<T>) event.getSource(); T item = getEntryWithKey(letter, choiceBox.getConverter(), choiceBox.getItems(), choiceBox); if (item != null) { choiceBox.setValue(item); } } } }
/** * https://github.com/AlmasB/FXGL/issues/493 * * @return menu content with video settings */ protected final MenuContent createContentVideo() { log.debug("createContentVideo()"); ChoiceBox<Language> languageBox = getUIFactory().newChoiceBox(FXCollections.observableArrayList(Language.values())); languageBox.setValue(Language.ENGLISH); getSettings().getLanguage().bind(languageBox.valueProperty()); VBox vbox = new VBox(); if (getSettings().isManualResizeEnabled()) { Button btnFixRatio = getUIFactory().newButton(localizedStringProperty("menu.fixRatio")); btnFixRatio.setOnAction(e -> { listener.fixAspectRatio(); }); vbox.getChildren().add(btnFixRatio); } if (getSettings().isFullScreenAllowed()) { CheckBox cbFullScreen = getUIFactory().newCheckBox(); cbFullScreen.setSelected(false); cbFullScreen.selectedProperty().bindBidirectional(getSettings().getFullScreen()); vbox.getChildren().add(new HBox(25, getUIFactory().newText(getLocalizedString("menu.fullscreen")+": "), cbFullScreen)); } return new MenuContent( new HBox(25, getUIFactory().newText(localizedStringProperty("menu.language").concat(":")), languageBox), vbox ); }
radius.setText(FORMAT.format(g.getRadius())); proportional.setSelected(g.isProportional()); cycleMethod.setValue(g.getCycleMethod());
endY.setText(FORMAT.format(g.getEndY())); proportional.setSelected(g.isProportional()); cycleMethod.setValue(g.getCycleMethod());
radius.setText(FORMAT.format(g.getRadius())); proportional.setSelected(g.isProportional()); cycleMethod.setValue(g.getCycleMethod());
endY.setText(FORMAT.format(g.getEndY())); proportional.setSelected(g.isProportional()); cycleMethod.setValue(g.getCycleMethod());