You are on page 1of 5

‫تقرير الطالب علي عبد الجبار‬

‫صباحي‬/ ‫مرحلة رابعة‬

Progress bar

// Java program to illustrate the use of progressbar


import javafx.application.Application;
import javafx.scene.Scene;
import javafx.scene.control.*;
import javafx.scene.layout.*;
import java.io.*;
import javafx.event.ActionEvent;
import javafx.event.EventHandler;
import javafx.scene.control.Label;
import javafx.stage.Stage;
import java.net.*;
public class progress extends Application {

static double ii = 0;

// launch the application


public void start(Stage s) throws Exception
{
s.setTitle("creating progressbar");

// create a progressbar
ProgressBar pb = new ProgressBar();
TilePane r = new TilePane();

// action event
EventHandler<ActionEvent> event = new EventHandler<ActionEvent>() {
public void handle(ActionEvent e)
{
// set progress to different level of progressbar
ii += 0.1;
pb.setProgress(ii);
}

};
Button b = new Button("increase");
// set on action
b.setOnAction(event);

// add button
r.getChildren().add(pb);
r.getChildren().add(b);
Scene sc = new Scene(r, 200, 200);
s.setScene(sc);

s.show();
}

public static void main(String args[])


{
// launch the application
launch(args);
}
}
‫التنفيذ يكون على هذا الشكل ‪:‬‬

You might also like