/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package progressindicatorcpu_11577;

import javafx.application.Application;
import javafx.scene.Group;
import javafx.scene.Scene;
import javafx.scene.control.Button;
import javafx.scene.control.ProgressIndicator;
import javafx.scene.control.ProgressBar;
import javafx.scene.paint.Color;
import javafx.stage.Stage;

import javafx.event.ActionEvent;
import javafx.event.EventHandler;

import com.sun.javafx.Logging;
import com.sun.javafx.logging.PlatformLogger;




/**
 * @author mickf
 */
public class Main extends Application {

    /**
     * @param args the command line arguments
     */
    public static void main(String[] args) {
        Application.launch(args);
    }

    ProgressIndicator pInd1;
    ProgressBar pBar1;


    boolean progVis = false;

    @Override public void start(Stage stage) {


        Scene scene = new Scene(new Group(), 600, 450);
        scene.setFill(Color.CHOCOLATE);

        Group root = (Group)scene.getRoot();

        pInd1 = new ProgressIndicator();
        pInd1.setPrefSize(50, 50);
        pInd1.setLayoutX(25);
        pInd1.setLayoutY(40);
        pInd1.setVisible(progVis);
        root.getChildren().add(pInd1);


        pBar1 = new ProgressBar();
        pBar1.setPrefSize(100, 10);
        pBar1.setLayoutX(25);
        pBar1.setLayoutY(240);
        pBar1.setVisible(progVis);
        root.getChildren().add(pBar1);


        Button buttonVis = new Button();
        buttonVis.setText("Toggle Visibility");
        buttonVis.setLayoutX(300);
        buttonVis.setLayoutY(40);
        buttonVis.setOnAction(new EventHandler<ActionEvent>() {
            @Override public void handle(ActionEvent e) {
                progVis = !progVis;
                pInd1.setVisible(progVis);
                pBar1.setVisible(progVis);
            }
        });
        root.getChildren().add(buttonVis);


        stage.setScene(scene);
        stage.setVisible(true);
    }
}