Java Code Examples for javafx.scene.control.ProgressBar#setProgress()
The following examples show how to use
javafx.scene.control.ProgressBar#setProgress() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: BaselineCorrectorSetupDialog.java From mzmine3 with GNU General Public License v2.0 | 5 votes |
private void addProgessBar() { // Add progress bar progressBar = new ProgressBar(); progressBar.setProgress(0.25); // progressBar.setetStringPainted(true); // Border border = // BorderFactory.createTitledBorder("Processing... <Press \"ESC\" to cancel> "); // progressBar.setBorder(border); dialog.mainPane.setTop(progressBar); // this.dialog.repaint(); progressBar.setVisible(true); // this.dialog.pack(); }
Example 2
Source File: ProgressBarSample.java From marathonv5 with Apache License 2.0 | 5 votes |
public ProgressBarSample() { super(400,100); double y = 15; final double SPACING = 15; ProgressBar p1 = new ProgressBar(); p1.setLayoutY(y); y += SPACING; ProgressBar p2 = new ProgressBar(); p2.setPrefWidth(150); p2.setLayoutY(y); y += SPACING; ProgressBar p3 = new ProgressBar(); p3.setPrefWidth(200); p3.setLayoutY(y); y = 15; ProgressBar p4 = new ProgressBar(); p4.setLayoutX(215); p4.setLayoutY(y); p4.setProgress(0.25); y += SPACING; ProgressBar p5 = new ProgressBar(); p5.setPrefWidth(150); p5.setLayoutX(215); p5.setLayoutY(y); p5.setProgress(0.50); y += SPACING; ProgressBar p6 = new ProgressBar(); p6.setPrefWidth(200); p6.setLayoutX(215); p6.setLayoutY(y); p6.setProgress(1); getChildren().addAll(p1,p2,p3,p4,p5,p6); }
Example 3
Source File: ProgressBarSample.java From marathonv5 with Apache License 2.0 | 5 votes |
public ProgressBarSample() { super(400,100); double y = 15; final double SPACING = 15; ProgressBar p1 = new ProgressBar(); p1.setLayoutY(y); y += SPACING; ProgressBar p2 = new ProgressBar(); p2.setPrefWidth(150); p2.setLayoutY(y); y += SPACING; ProgressBar p3 = new ProgressBar(); p3.setPrefWidth(200); p3.setLayoutY(y); y = 15; ProgressBar p4 = new ProgressBar(); p4.setLayoutX(215); p4.setLayoutY(y); p4.setProgress(0.25); y += SPACING; ProgressBar p5 = new ProgressBar(); p5.setPrefWidth(150); p5.setLayoutX(215); p5.setLayoutY(y); p5.setProgress(0.50); y += SPACING; ProgressBar p6 = new ProgressBar(); p6.setPrefWidth(200); p6.setLayoutX(215); p6.setLayoutY(y); p6.setProgress(1); getChildren().addAll(p1,p2,p3,p4,p5,p6); }
Example 4
Source File: ProgressSample.java From marathonv5 with Apache License 2.0 | 5 votes |
@Override public void start(Stage stage) { Group root = new Group(); Scene scene = new Scene(root, 300, 250); stage.setScene(scene); stage.setTitle("Progress Controls"); for (int i = 0; i < values.length; i++) { final Label label = labels[i] = new Label(); label.setText("progress:" + values[i]); final ProgressBar pb = pbs[i] = new ProgressBar(); pb.setProgress(values[i]); final ProgressIndicator pin = pins[i] = new ProgressIndicator(); pin.setProgress(values[i]); final HBox hb = hbs[i] = new HBox(); hb.setSpacing(5); hb.setAlignment(Pos.CENTER); hb.getChildren().addAll(label, pb, pin); } final VBox vb = new VBox(); vb.setSpacing(5); vb.getChildren().addAll(hbs); scene.setRoot(vb); stage.show(); }
Example 5
Source File: ProgressSample.java From mars-sim with GNU General Public License v3.0 | 5 votes |
@Override public void start(Stage stage) { Group root = new Group(); Scene scene = new Scene(root, 300, 250); stage.setScene(scene); stage.setTitle("Progress Controls"); for (int i = 0; i < values.length; i++) { final Label label = labels[i] = new Label(); label.setText("progress:" + values[i]); final ProgressBar pb = pbs[i] = new ProgressBar(); pb.setProgress(values[i]); final ProgressIndicator pin = pins[i] = new ProgressIndicator(); pin.setProgress(values[i]); final HBox hb = hbs[i] = new HBox(); hb.setSpacing(5); hb.setAlignment(Pos.CENTER); //hb.getChildren().addAll(label, pb, pin); hb.getChildren().addAll(pin); } final VBox vb = new VBox(); vb.setSpacing(5); vb.getChildren().addAll(hbs); scene.setRoot(vb); stage.show(); }
Example 6
Source File: ParameterSetComponent.java From mzmine3 with GNU General Public License v2.0 | 4 votes |
public ParameterSetComponent(final ParameterSet parameters) { this.parameters = parameters; // this.setBorder(BorderFactory.createEmptyBorder(0, 9, 0, 0)); lblParameters = new Label(); lblParameters.setDisable(true); this.add(lblParameters, 0, 0); btnChange = new Button("Change"); btnChange.setOnAction(e -> { if (parameters == null) return; ExitCode exitCode = parameters.showSetupDialog(true); if (exitCode != ExitCode.OK) return; updateLabel(); }); this.add(btnChange, 1, 0); progressBar = new ProgressBar(); progressBar.setProgress(0.0); progressBar.setVisible(false); // progressBar.setStringPainted(true); this.add(progressBar, 0, 1, 2, 1); // if (process != null) { // SwingUtilities.invokeLater(new Runnable() { // public void run() { // int value = (int) Math.round(process.getFinishedPercentage()); // if (0 < value && value < 100) { // progressBar.setValue(value); // progressBar.setVisible(true); // } else { // progressBar.setValue(0); // progressBar.setVisible(false); // } // // try { // Thread.sleep(5); // } // catch (InterruptedException e) { // progressBar.setValue(0); // progressBar.setVisible(false); // } // } // }); // } }
Example 7
Source File: PlanningCenterOnlineParser.java From Quelea with GNU General Public License v3.0 | 4 votes |
public String downloadFile(Media media, Attachment attachment, String fileName, ProgressBar progressBar, LocalDateTime lastUpdated) { try { QueleaProperties props = QueleaProperties.get(); String fullFileName = FilenameUtils.concat(props.getDownloadPath(), fileName); File file = new File(fullFileName); if (file.exists()) { long lastModified = file.lastModified(); if (lastUpdated == null || lastUpdated.atZone(ZoneOffset.UTC).toInstant().toEpochMilli() <= lastModified) { LOGGER.log(Level.INFO, "{0} exists, using existing file", file.getAbsolutePath()); return file.getAbsolutePath(); } // file is going to get overridden as it failed the timestamp check if (!file.delete()) { // deletion of exiting file failed! just use the existing file then LOGGER.log(Level.INFO, "Couldn''t delete existing file: {0}", file.getAbsolutePath()); return file.getAbsolutePath(); } } String partFullFileName = fullFileName + ".part"; File partFile = new File(partFullFileName); AttachmentActivity attachmentActivity = planningCenterClient.services().media(media.getId()).attachment(attachment.getId()).api().open().execute().body().get(); HttpResponse response = httpClient.execute(new HttpGet(attachmentActivity.getAttachmentUrl())); HttpEntity entity = response.getEntity(); if (entity != null) { long contentLength = entity.getContentLength(); InputStream is = entity.getContent(); try (BufferedOutputStream bos = new BufferedOutputStream(new FileOutputStream(partFile))) { Long totalBytesRead = 0L; byte buffer[] = new byte[1024 * 1024]; int count; while ((count = is.read(buffer)) != -1) { bos.write(buffer, 0, count); totalBytesRead += count; progressBar.setProgress((double) totalBytesRead / (double) contentLength); } } EntityUtils.consume(entity); } boolean success = partFile.renameTo(file); if (success && lastUpdated != null) { file.setLastModified(lastUpdated.atZone(ZoneOffset.UTC).toInstant().toEpochMilli()); // set file timestamp to same as on PCO } return file.getAbsolutePath(); } catch (Exception e) { LOGGER.log(Level.WARNING, "Error", e); } return ""; }
Example 8
Source File: JavaFXProgressBarElement.java From marathonv5 with Apache License 2.0 | 4 votes |
@Override public boolean marathon_select(String value) { ProgressBar progressBar = (ProgressBar) getComponent(); progressBar.setProgress(Double.parseDouble(value)); return true; }
Example 9
Source File: ProgressBarDemo.java From JFoenix with Apache License 2.0 | 4 votes |
@Override public void start(Stage stage) throws Exception { final VBox pane = new VBox(); pane.setSpacing(30); pane.setStyle("-fx-background-color:WHITE"); ProgressBar bar = new ProgressBar(); bar.setPrefWidth(500); ProgressBar cssBar = new ProgressBar(); cssBar.setPrefWidth(500); cssBar.setProgress(-1.0f); JFXProgressBar jfxBar = new JFXProgressBar(); jfxBar.setPrefWidth(500); JFXProgressBar jfxBarInf = new JFXProgressBar(); jfxBarInf.setPrefWidth(500); jfxBarInf.setProgress(-1.0f); Timeline timeline = new Timeline( new KeyFrame( Duration.ZERO, new KeyValue(bar.progressProperty(), 0), new KeyValue(jfxBar.secondaryProgressProperty(), 0), new KeyValue(jfxBar.progressProperty(), 0)), new KeyFrame( Duration.seconds(1), new KeyValue(jfxBar.secondaryProgressProperty(), 1)), new KeyFrame( Duration.seconds(2), new KeyValue(bar.progressProperty(), 1), new KeyValue(jfxBar.progressProperty(), 1))); timeline.setCycleCount(Timeline.INDEFINITE); timeline.play(); pane.getChildren().addAll(bar, jfxBar, cssBar, jfxBarInf); StackPane main = new StackPane(); main.getChildren().add(pane); main.setBackground(new Background(new BackgroundFill(Color.WHITE, CornerRadii.EMPTY, Insets.EMPTY))); StackPane.setMargin(pane, new Insets(20, 0, 0, 20)); final Scene scene = new Scene(main, 600, 200, Color.WHITE); scene.getStylesheets().add(ProgressBarDemo.class.getResource("/css/jfoenix-components.css").toExternalForm()); stage.setTitle("JFX ProgressBar Demo "); stage.setScene(scene); stage.setResizable(false); stage.show(); }