-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMain.java
More file actions
49 lines (40 loc) · 1.58 KB
/
Main.java
File metadata and controls
49 lines (40 loc) · 1.58 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
package com.company;
import javafx.application.Application;
import javafx.geometry.Pos;
import javafx.scene.Scene;
import javafx.scene.control.Label;
import javafx.scene.layout.VBox;
import javafx.stage.Stage;
import javafx.animation.Animation;
import javafx.event.ActionEvent;
import javafx.event.EventHandler;
import javafx.scene.layout.StackPane;
import javafx.scene.control.Button;
public class Main extends Application{
Button button;
Scene scene1,scene2;
@Override
public void start(Stage window) throws Exception {
window.setTitle("Widgets"); //programme name
Label welcoming_label = new Label("Welcome to the widgets programme"); //text on the scene
Button button_start = new Button("Start");
button_start.setOnAction(e -> window.setScene(scene_widgets));
//Layout 1 - children and laid out in the center
VBox layout1st = new VBox(20);
layout1st.getChildren().addAll(welcoming_label, button_start);
layout1st.setAlignment(Pos.CENTER);
scene_begin = new Scene(layout1st, 800, 500);
//button_widgets
Button button_widgets = new Button("Select");
button_widgets.setOnAction(e -> window.setScene(scene_begin));
//Layout 2
StackPane layout2nd = new StackPane(); //just "background"
layout2nd.getChildren().add(button_widgets); //show objects on bg
layout2nd.setAlignment(Pos.BOTTOM_CENTER);
scene_widgets = new Scene(layout2nd, 800, 500);
window.show();
}
public static void main(String[] args) {
Application.launch(args);
}
}