Java Code Examples for javafx.scene.control.ProgressIndicator#setProgress()
The following examples show how to use
javafx.scene.control.ProgressIndicator#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: ProgressIndicatorSample.java From marathonv5 with Apache License 2.0 | 5 votes |
public ProgressIndicatorSample() { super(400,400); GridPane g = new GridPane(); ProgressIndicator p1 = new ProgressIndicator(); p1.setPrefSize(50, 50); ProgressIndicator p2 = new ProgressIndicator(); p2.setPrefSize(50, 50); p2.setProgress(0.25F); ProgressIndicator p3 = new ProgressIndicator(); p3.setPrefSize(50, 50); p3.setProgress(0.5F); ProgressIndicator p4 = new ProgressIndicator(); p4.setPrefSize(50, 50); p4.setProgress(1.0F); g.add(p1, 1, 0); g.add(p2, 0, 1); g.add(p3, 1, 1); g.add(p4, 2, 1); g.setHgap(40); g.setVgap(40); getChildren().add(g); }
Example 2
Source File: ProgressIndicatorSample.java From marathonv5 with Apache License 2.0 | 5 votes |
public ProgressIndicatorSample() { super(400,400); GridPane g = new GridPane(); ProgressIndicator p1 = new ProgressIndicator(); p1.setPrefSize(50, 50); ProgressIndicator p2 = new ProgressIndicator(); p2.setPrefSize(50, 50); p2.setProgress(0.25F); ProgressIndicator p3 = new ProgressIndicator(); p3.setPrefSize(50, 50); p3.setProgress(0.5F); ProgressIndicator p4 = new ProgressIndicator(); p4.setPrefSize(50, 50); p4.setProgress(1.0F); g.add(p1, 1, 0); g.add(p2, 0, 1); g.add(p3, 1, 1); g.add(p4, 2, 1); g.setHgap(40); g.setVgap(40); getChildren().add(g); }
Example 3
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 4
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 5
Source File: TailingReader.java From pikatimer with GNU General Public License v3.0 | 4 votes |
@Override public void showControls(Pane p) { if (displayPane == null) { // initialize our display displayHBox = new HBox(); displayVBox = new VBox(); watchProgressIndicator = new ProgressIndicator(); autoImportToggleSwitch = new ToggleSwitch("Auto-Import File"); autoImportToggleSwitch.selectedProperty().set(false); autoImportToggleSwitch.setPadding(new Insets(3, 0, 0, 0)); // this is a hack to get around a ToggleSwitch bug //autoImportToggleSwitch.setMaxWidth(75); statusLabel = new Label(""); inputButton = new Button("Select File..."); inputTextField = new TextField(); displayVBox.setSpacing(5); //displayVBox.setPadding(new Insets(5, 5, 5, 5)); inputTextField.focusedProperty().addListener((ObservableValue<? extends Boolean> arg0, Boolean oldPropertyValue, Boolean newPropertyValue) -> { if (!newPropertyValue && !fileName.getValueSafe().equals(inputTextField.textProperty().getValueSafe())) { // if we are auto-importing, stop that stopReading(); sourceFile = new File(inputTextField.textProperty().getValueSafe()).getAbsoluteFile(); fileName.setValue(sourceFile.getAbsolutePath()); // save the filename timingListener.setAttribute("TailingReader:filename", inputTextField.textProperty().getValueSafe()); // read the file if (!sourceFile.canRead()){ statusLabel.setText("Unable to open file: " + fileName.getValueSafe()); } else readOnce(); } else { System.out.println("No change in file name"); } }); displayHBox.setSpacing(5); displayHBox.setAlignment(Pos.CENTER_LEFT); displayHBox.getChildren().addAll(inputTextField, inputButton, autoImportToggleSwitch, watchProgressIndicator); displayVBox.getChildren().addAll(displayHBox, statusLabel); // Set the action for the inputButton inputButton.setOnAction((event) -> { // Button was clicked, do something... selectInput(); }); watchProgressIndicator.visibleProperty().bind(autoImportToggleSwitch.selectedProperty()); watchProgressIndicator.setProgress(-1.0); // get the current status of the reader //watchProgressIndicator.setPrefHeight(30.0); watchProgressIndicator.setMaxHeight(30.0); autoImportToggleSwitch.selectedProperty().addListener((ObservableValue<? extends Boolean> observable, Boolean oldValue, Boolean newValue) -> { if(newValue) { System.out.println("TailingReader: autoImportToggleSwitch event: calling startReading()"); startReading(); } else { System.out.println("TailingReader: autoImportToggleSwitch event: calling stopReading()"); stopReading(); } }); autoImportToggleSwitch.selectedProperty().bindBidirectional(readingStatus); inputTextField.textProperty().setValue(fileName.getValueSafe()); // set the action for the inputTextField } // If we were previously visible, clear the old one if (displayPane != null) displayPane.getChildren().clear(); // Now show ourselves.... displayPane = p; displayPane.getChildren().clear(); displayPane.getChildren().add(displayVBox); }
Example 6
Source File: WmsLayerUrlSample.java From arcgis-runtime-samples-java with Apache License 2.0 | 4 votes |
@Override public void start(Stage stage) { try { // create stack pane and application scene StackPane stackPane = new StackPane(); Scene scene = new Scene(stackPane); // set title, size, and add scene to stage stage.setTitle("WMS Layer URL Sample"); stage.setWidth(800); stage.setHeight(700); stage.setScene(scene); stage.show(); // create a map and add it to the map view ArcGISMap map = new ArcGISMap(Basemap.createLightGrayCanvas()); mapView = new MapView(); mapView.setMap(map); // start zoomed in over the US mapView.setViewpointGeometryAsync(new Envelope(-19195297.778679, 512343.939994, -3620418.579987, 8658913.035426, 0.0, 0.0, SpatialReferences.getWebMercator())); // show a progress indicator while the layer loads ProgressIndicator progressIndicator = new ProgressIndicator(); progressIndicator.setProgress(ProgressIndicator.INDETERMINATE_PROGRESS); progressIndicator.setMaxSize(25, 25); // create a WMS layer List<String> wmsLayerNames = Collections.singletonList("1"); String url = "https://nowcoast.noaa.gov/arcgis/services/nowcoast/radar_meteo_imagery_nexrad_time/MapServer/WMSServer?request=GetCapabilities&service=WMS"; wmsLayer = new WmsLayer(url, wmsLayerNames); // load the layer and add it as an operational layer wmsLayer.addDoneLoadingListener(() -> { if (wmsLayer.getLoadStatus() != LoadStatus.LOADED) { wmsLayer.getLoadError().printStackTrace(); new Alert(Alert.AlertType.ERROR, "Failed to load WMS layer").show(); } progressIndicator.setVisible(false); }); map.getOperationalLayers().add(wmsLayer); // add the map view to stack pane stackPane.getChildren().addAll(mapView, progressIndicator); StackPane.setAlignment(progressIndicator, Pos.CENTER); } catch (Exception e) { // on any error, display the stack trace. e.printStackTrace(); } }
Example 7
Source File: StatusCellFactory.java From archivo with GNU General Public License v3.0 | 4 votes |
private void setProgress(double value) { ProgressIndicator indicator = getProgressIndicator(); indicator.setProgress(value); setGraphic(indicator); }