@Override public void start(Stage stage) { if (!Platform.isSupported(ConditionalFeature.SCENE3D)) { throw new RuntimeException("*** ERROR: common conditional SCENE3D is not supported"); } stage.setTitle("JavaFX SubScene And Scene Anti-aliasing Test"); Group root = new Group(); Scene scene = new Scene(root, 1000, 800); scene.setFill(Color.color(0.2, 0.2, 0.2, 1.0)); HBox hbox = new HBox(); hbox.setLayoutX(75); hbox.setLayoutY(200); PhongMaterial phongMaterial = new PhongMaterial(Color.color(1.0, 0.7, 0.8)); Cylinder cylinder1 = new Cylinder(100, 200); cylinder1.setMaterial(phongMaterial); SubScene noMsaa = createSubScene( "Scene Anti-aliasing = false", cylinder1, Color.TRANSPARENT, new PerspectiveCamera(), false); hbox.getChildren().add(noMsaa); Cylinder cylinder2 = new Cylinder(100, 200); cylinder2.setMaterial(phongMaterial); SubScene msaa = createSubScene( "Scene Anti-aliasing = true", cylinder2, Color.TRANSPARENT, new PerspectiveCamera(), true); hbox.getChildren().add(msaa); Slider slider = new Slider(0, 360, 0); slider.setBlockIncrement(1); slider.setTranslateX(425); slider.setTranslateY(625); cylinder1.rotateProperty().bind(slider.valueProperty()); cylinder2.rotateProperty().bind(slider.valueProperty()); root.getChildren().addAll(hbox, slider); stage.setScene(scene); stage.show(); }
private void initSettingsPane() { trainTroopsSlider.setMin(0); trainTroopsSlider.setMax(Settings.MAX_TRAIN_TROOPS); trainTroopsSlider.setBlockIncrement(1); trainTroopsSlider .valueProperty() .addListener( (observable, oldValue, newValue) -> { trainTroopsSliderPreview.setText( String.format("%d", MainController.toInt(newValue.doubleValue()))); }); final Troop[] availableTroops = model.getAvailableTroops(); rax1ComboBox.getItems().addAll(availableTroops); rax2ComboBox.getItems().addAll(availableTroops); rax3ComboBox.getItems().addAll(availableTroops); rax4ComboBox.getItems().addAll(availableTroops); rax5ComboBox.getItems().addAll(availableTroops); rax6ComboBox.getItems().addAll(availableTroops); autoAttackComboBox.getItems().addAll(Attack.noStrategy()); autoAttackComboBox.getItems().addAll(Attack.getAvailableStrategies()); autoAttackComboBox.setValue(autoAttackComboBox.getItems().get(0)); final ChangeListener<String> intFieldListener = (observable, oldValue, newValue) -> { try { if (!newValue.isEmpty()) { Integer.parseInt(newValue); } } catch (final NumberFormatException e) { ((TextField) ((StringProperty) observable).getBean()).setText(oldValue); } }; goldField.textProperty().addListener(intFieldListener); elixirField.textProperty().addListener(intFieldListener); deField.textProperty().addListener(intFieldListener); maxThField.textProperty().addListener(intFieldListener); logLevelComboBox .getItems() .addAll( Level.FINEST, Level.FINER, Level.FINE, Level.CONFIG, Level.INFO, Level.WARNING, Level.SEVERE); logLevelComboBox.setValue(logLevelComboBox.getItems().get(1)); updateUI(); }
public void initialize(URL location, ResourceBundle resources) { txtFieldGeldEingabe.textProperty().bindBidirectional(viewModel.geldEingabe()); txtFieldZeitEingabe.textProperty().bindBidirectional(viewModel.zeitEinagabe()); labelQualitaet.textProperty().bindBidirectional(viewModel.qualitaetText()); labelZeit.textProperty().bindBidirectional(viewModel.zeitText()); labelSkill.textProperty().bindBidirectional(viewModel.skillText()); labelGehalt.textProperty().bindBidirectional(viewModel.gehaltText()); labelGeld.textProperty().bindBidirectional(viewModel.geldText()); labelGesundheit.textProperty().bindBidirectional(viewModel.gesundheitText()); labelMotivation.textProperty().bindBidirectional(viewModel.motivationText()); SliderGehalt.valueProperty().bindBidirectional(viewModel.gehaltProperty()); SliderGehalt.setValue(1500); SliderGehalt.setShowTickMarks(false); SliderGehalt.setMajorTickUnit(1); SliderGehalt.setMinorTickCount(0); SliderGehalt.setBlockIncrement(100); SliderGehalt.setSnapToTicks(true); labelNeuesGehalt.textProperty().bind(SliderGehalt.valueProperty().asString("%.0f")); buttonStart.setOnAction( event -> { buttonNachsteRunde.setDisable(false); buttonStart.setDisable(true); txtFieldGeldEingabe.setDisable(true); txtFieldZeitEingabe.setDisable(true); viewModel.startRound(); }); buttonNachsteRunde.setOnAction( event -> { RadioButton rb = (RadioButton) ToggleGroupSelect.getSelectedToggle(); viewModel.nextRound(rb.getText()); }); viewModel.setButtonNaechsteRunde(buttonNachsteRunde); viewModel.setButtonStart(buttonStart); viewModel.setTxtFieldGeldEingabe(txtFieldGeldEingabe); viewModel.setTxtFieldZeitEingabe(txtFieldZeitEingabe); }