Search in sources :

Example 1 with JFXProgressBar

use of com.jfoenix.controls.JFXProgressBar in project JFoenix by jfoenixadmin.

the class ProgressBarDemo method start.

@Override
public void start(Stage stage) throws Exception {
    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.progressProperty(), 0)), 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("/resources/css/jfoenix-components.css").toExternalForm());
    stage.setTitle("JFX ProgressBar Demo ");
    stage.setScene(scene);
    stage.setResizable(false);
    stage.show();
}
Also used : Timeline(javafx.animation.Timeline) KeyValue(javafx.animation.KeyValue) Insets(javafx.geometry.Insets) JFXProgressBar(com.jfoenix.controls.JFXProgressBar) KeyFrame(javafx.animation.KeyFrame) Scene(javafx.scene.Scene) JFXProgressBar(com.jfoenix.controls.JFXProgressBar) ProgressBar(javafx.scene.control.ProgressBar)

Aggregations

JFXProgressBar (com.jfoenix.controls.JFXProgressBar)1 KeyFrame (javafx.animation.KeyFrame)1 KeyValue (javafx.animation.KeyValue)1 Timeline (javafx.animation.Timeline)1 Insets (javafx.geometry.Insets)1 Scene (javafx.scene.Scene)1 ProgressBar (javafx.scene.control.ProgressBar)1