-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathGUI.java
More file actions
82 lines (61 loc) · 2.37 KB
/
Copy pathGUI.java
File metadata and controls
82 lines (61 loc) · 2.37 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
package carbookingsystem1;
import java.util.ArrayList;
import javafx.application.Application;
import static javafx.application.Application.launch;
import javafx.event.ActionEvent;
import javafx.event.EventHandler;
import javafx.geometry.Insets;
import javafx.geometry.Pos;
import javafx.scene.Scene;
import javafx.scene.control.Button;
import javafx.scene.control.TextArea;
import javafx.scene.layout.Background;
import javafx.scene.layout.BackgroundFill;
import javafx.scene.layout.GridPane;
import javafx.scene.paint.Color;
import javafx.scene.text.Font;
import javafx.scene.text.FontWeight;
import javafx.scene.text.Text;
import javafx.stage.Stage;
public class GUI extends Application {
@Override
public void start(Stage stage) {
GridPane grid = new GridPane();
grid.setAlignment(Pos.CENTER);
grid.setHgap(10);
grid.setVgap(10);
grid.setPadding(new Insets(30));
Text welcomeMsg = new Text(" -- Welcome TO Our Car Booking System -- ");
welcomeMsg.setFont(Font.font("Tahoma", FontWeight.EXTRA_BOLD, 16));
grid.setBackground(new Background(new BackgroundFill(Color.AZURE, null, null)));
welcomeMsg.setFill(Color.BLUE);
grid.add(welcomeMsg, 0, 0, 2, 1);
TextArea tArea = new TextArea();
tArea.setEditable(false);
grid.add(tArea, 0, 1, 2, 2);
Button btn = new Button("Display Cars");
btn.setTextFill(Color.AZURE);
btn.setBackground(new Background(new BackgroundFill(Color.BLUE, null, null)));
btn.setOnAction(new EventHandler<ActionEvent>() {
@Override
public void handle(ActionEvent event) {
ArrayList<Car> list = MainClass.arrayList;
String s = "";
for (Car c : list) {
s += c + "\n=========================\n";
}
tArea.setText(s);
}
}
);
grid.add(btn, 1, 3);
Scene scene = new Scene(grid, 400, 300);
stage.setScene(scene);
stage.setTitle("Car Booking System");
stage.show();
stage.setResizable(false);
}
public static void main(String[] args) {
launch(args);
}
}