protected void updateValues() { if (timeProgress != null && timeSlider != null && volumeSlider != null) { Platform.runLater( () -> { Duration currentTime = mp.getCurrentTime(); timeProgress.setText(formatTime(currentTime, duration)); timeSlider.setDisable(duration.isUnknown()); if (!timeSlider.isDisabled() && duration.greaterThan(Duration.ZERO) && !timeSlider.isValueChanging()) { timeSlider.setValue(mp.getCurrentTime().divide(duration).toMillis() * 100.0); progressBar.setProgress(timeSlider.getValue() / 100); } if (!volumeSlider.isValueChanging()) { volumeSlider.setValue(mp.getVolume()); if (mp.getVolume() == 0.0) { volumeButton.setImage(new Image("icon/Volume_button/mute.png")); } else { volumeButton.setImage(new Image("icon/Volume_button/volume.png")); } } }); } }
@FXML public void handleSaveButtonAction() { model.saveSettings( (settings) -> { if (!goldField.getText().isEmpty()) { settings.setGoldThreshold(Integer.parseInt(goldField.getText())); } if (!elixirField.getText().isEmpty()) { settings.setElixirThreshold(Integer.parseInt(elixirField.getText())); } if (!deField.getText().isEmpty()) { settings.setDarkElixirThreshold(Integer.parseInt(deField.getText())); } if (!maxThField.getText().isEmpty()) { settings.setMaxThThreshold(Integer.parseInt(maxThField.getText())); } settings.setDetectEmptyCollectors(detectEmptyCollectorsCheckBox.isSelected()); settings.setMatchAllConditions(isMatchAllConditionsCheckBox.isSelected()); settings.setCollectResources(collectResourcesCheckBox.isSelected()); settings.setTrainMaxTroops(toInt(trainTroopsSlider.getValue())); settings.setLogLevel(logLevelComboBox.getValue()); settings.setAttackStrategy(autoAttackComboBox.getValue()); settings.getRaxInfo()[0] = rax1ComboBox.getValue(); settings.getRaxInfo()[1] = rax2ComboBox.getValue(); settings.getRaxInfo()[2] = rax3ComboBox.getValue(); settings.getRaxInfo()[3] = rax4ComboBox.getValue(); settings.getRaxInfo()[4] = rax5ComboBox.getValue(); settings.getRaxInfo()[5] = rax6ComboBox.getValue(); settings.setExtraFunctions(extraFuncCheckBox.isSelected()); }); showSettings(false); }
private void generateCostAndStat() { String skill = selectedSkill.getText(); power = (int) power_slider.getValue(); dailyCost = power * 50; credits_label.setText(dailyCost + " Credits"); stat_name_label.setText(skill + ": "); switch (skill) { case "Fighter": stats_label.setText("" + (player.getFighterSkillPoints() + power)); break; case "Pilot": stats_label.setText("" + (player.getPilotSkillPoints() + power)); break; case "Engineer": stats_label.setText("" + (player.getEngineerSkillPoints() + power)); break; case "Trader": stats_label.setText("" + (player.getTraderSkillPoints() + power)); break; default: stats_label.setText("" + (player.getInvestorSkillPoints() + power)); break; } checkForHire(); }
@FXML private void btvolumeChange1(MouseEvent event) { if (volumeSlider.getValue() != 0) { volumeButton.setImage(new Image("icon/Volume_button/volume_hover.png")); } else { volumeButton.setImage(new Image("icon/Volume_button/mute_hover.png")); } }
@FXML private void handleProgress(MouseEvent event) { if (event.getButton() == MouseButton.PRIMARY) { if (play = true) { mp.seek( Duration.seconds((mp.getTotalDuration().toSeconds() * timeSlider.getValue() / 100))); } } }
@FXML public void compute() { double[][] transformedTrajectory = getTransformedTrajectory(); if (transformedTrajectory == null) return; // compute and display RP BufferedImage rp = DRQA.getRPImage( transformedTrajectory, transformedTrajectory, recurrenceThresholdSlider.getValue()); rpImageView.setImage(SwingFXUtils.toFXImage(rp, null)); applyImageScale(); // compute and display CRT DRQA.conditional_ww_limit = Integer.parseInt(crtLimit.getText()); DRQA.CRT_LOG_SCALE = logScaleCheckBox.isSelected(); drqa = new DRQA( transformedTrajectory, transformedTrajectory, recurrenceThresholdSlider.getValue()); BufferedImage crt = drqa.getCRTImage(DRQA.conditional_ww_limit, drqa.conditional_ww); crtImageView.setImage(SwingFXUtils.toFXImage(crt, null)); String[] stats = drqa.crtStatistics().split("\t"); crtStats.setText( String.format( "mean row: %.2f\tmean col: %.2f\ncorrelation: %.2f\nmax row: %s\tmax col: %s\nlocal maxima: %s\nentropy: %.2f", Double.parseDouble(stats[0]), Double.parseDouble(stats[1]), Double.parseDouble(stats[2]), stats[3], stats[4], stats[5], Double.parseDouble(stats[6]))); drqa.computeRQA(2, 2, 2); rqaMeasures.setText(drqa.printableString(DRQA.STANDARD_RQA)); updateTimeSeriesChart(); updateDistanceDistributionChart(); updateLineLengthHistogram( null, null, lineLengthTypeSelector.getSelectionModel().getSelectedIndex()); }
public void start(Stage primaryStage) { primaryStage.setTitle("Lines"); Group root = new Group(); Scene scene = new Scene(root, 300, 150, Color.GRAY); Line redLine = new Line(10, 10, 200, 10); redLine.setStroke(Color.RED); redLine.setStrokeWidth(10); redLine.setStrokeLineCap(StrokeLineCap.BUTT); redLine.getStrokeDashArray().addAll(10d, 5d, 15d, 5d, 20d); redLine.setStrokeDashOffset(0); root.getChildren().add(redLine); Line whiteLine = new Line(10, 30, 200, 30); whiteLine.setStroke(Color.WHITE); whiteLine.setStrokeWidth(10); whiteLine.setStrokeLineCap(StrokeLineCap.ROUND); root.getChildren().add(whiteLine); Line blueLine = new Line(10, 50, 200, 50); blueLine.setStroke(Color.BLUE); blueLine.setStrokeWidth(10); root.getChildren().add(blueLine); Slider slider = new Slider(0, 100, 0); slider.setLayoutX(10); slider.setLayoutY(95); redLine.strokeDashOffsetProperty().bind(slider.valueProperty()); root.getChildren().add(slider); Text offsetText = new Text("Stroke Dash Offset: 0.0"); offsetText.setX(10); offsetText.setY(80); offsetText.setStroke(Color.WHITE); slider .valueProperty() .addListener( (ov, curVal, newVal) -> offsetText.setText("Stroke Dash Offset: " + slider.getValue())); root.getChildren().add(offsetText); primaryStage.setScene(scene); primaryStage.show(); }
public ButtonedSlider(double minValue, double maxValue, double currentValue) { double diff = Math.max(0, maxValue - minValue); slider = new Slider(minValue, maxValue, currentValue); slider.setPadding(new Insets(3)); BorderPane.setAlignment(slider, Pos.CENTER); setCenter(slider); Button minusButton = new Button("-"); minusButton.setMinSize(16, 16); minusButton.setPrefSize(16, 16); minusButton.setMaxSize(16, 16); BorderPane.setAlignment(minusButton, Pos.CENTER); minusButton.setOnAction(e -> slider.setValue(slider.getValue() - diff / 20.0)); setLeft(minusButton); Button plusButton = new Button("+"); plusButton.setMinSize(16, 16); plusButton.setPrefSize(16, 16); plusButton.setMaxSize(16, 16); BorderPane.setAlignment(plusButton, Pos.CENTER); plusButton.setOnAction(e -> slider.setValue(slider.getValue() + diff / 20.0)); setRight(plusButton); }
@FXML private void handleNameAction(Event e) { emptyName = false; for (Player player : Config.getInstance().playerList) { if (player.getName().equals("") && player.getId() < numSlider.getValue()) { emptyName = true; } } if (emptyName) { nameLabel.setTextFill(Color.RED); // disallow empty name startButton.setDisable(true); } else { nameLabel.setTextFill(Color.BLACK); startButton.setDisable(false); } Config.getInstance() .playerList[Config.getInstance().currentPlayer] .setName(nameField.getText()); }
@FXML private void handleRecording() { if (recordingOn) { recordingOn = false; imageView.setImage(null); recordingButton.setText("Start Recording"); appendToProtocol("... recording stopped"); try { recorder.stop(); speechToTextTransformer.stop(); } catch (InterruptedException e) { appendToProtocol("error stopping recorder"); e.printStackTrace(); } } else { recordingOn = true; imageView.setImage(recordingImage); recordingButton.setText("Stop Recording"); int timesInSeconds = new Double(slider.getValue()).intValue(); appendToProtocol("start recording (" + timesInSeconds + "s chunks)..."); recorder.start(timesInSeconds); speechToTextTransformer.start(); } }
private void onPlay() { playButton.setImage(new Image("icon/PlayPause_button/pause.png")); mp.setOnReady( () -> { duration = mp.getMedia().getDuration(); updateValues(); }); mp.currentTimeProperty() .addListener( (Observable ov) -> { Stage stage = (Stage) root.getScene().getWindow(); if (stage.isFullScreen() == false) { full = false; } updateValues(); }); mp.setOnPaused( () -> { playButton.setImage(new Image("icon/PlayPause_button/play.png")); }); mp.setOnEndOfMedia( () -> { switch (repeat) { case 0: if (fileList.size() - 1 == 0) { mp.stop(); mp.seek(mp.getStartTime()); } else { listView.getSelectionModel().selectNext(); } break; case 1: mp.seek(Duration.ZERO); mp.setCycleCount(MediaPlayer.INDEFINITE); break; case 2: if (j == fileList.size() - 1) { if (fileList.size() - 1 == 0) { mp.setCycleCount(MediaPlayer.INDEFINITE); } else { listView.getSelectionModel().selectFirst(); } } else { listView.getSelectionModel().selectNext(); } break; } atEndOfMedia = true; }); timeSlider .valueProperty() .addListener( (Observable ov) -> { if (timeSlider.isValueChanging()) { progressBar.setProgress(timeSlider.getValue() / 100); mp.seek(duration.multiply(timeSlider.getValue() / 100.0)); } }); volumeSlider .valueProperty() .addListener( (ObservableValue<? extends Number> ov, Number old_val, Number new_val) -> { mp.setVolume(new_val.doubleValue()); volumeBar.setProgress(new_val.doubleValue()); }); play = true; volumeSlider.setMouseTransparent(!play); timeSlider.setMouseTransparent(!play); }
private double getSpeed() { return speedSlider.getValue() / 33.0 + 0.1; }
public double getValue() { return slider.getValue(); }
@FXML private void handlePlayerAction(Event e) { changePlayer(((int) playerSlider.getValue()) - 1); }
@FXML private void handleNumAction(Event e) { Config.getInstance().numOfPlayers = (int) numSlider.getValue(); adjustPlayerCount(); }