Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import javafx.application.Application;
- import javafx.stage.Stage;
- import javafx.event.ActionEvent;
- import javafx.event.EventHandler;
- import javafx.scene.Scene;
- import javafx.scene.control.Label;
- import javafx.scene.control.Button;
- import javafx.scene.layout.StackPane;
- import javafx.scene.layout.VBox; //error appears after the semicolon on this line
- public class Main extends Application {
- Scene s1, s2;
- public static void main(String[] args) {
- launch(args);
- }
- @Override
- public void start(Stage window) {
- Label label1 = new Label("s1");
- Button button1 = new Button("Click for s2");
- button1.setOnAction(e -> window.setScene(s2));
- VBox lay1 = new VBox(50);
- lay1.getChildren().addAll(label1, button1);
- s1 = new Scene(lay1, 500, 500);
- Button button2 = new Button("Click for s1");
- button2.setOnAction(e -> window.setScene(s1));
- s2 = new Scene(lay1, 300, 250);
- window.setScene(s1);
- window.setTitle("title");
- window.show();
- }
- }
Add Comment
Please, Sign In to add comment