Guest User

Untitled

a guest
Oct 22nd, 2017
75
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.04 KB | None | 0 0
  1. import javafx.application.Application;
  2. import javafx.stage.Stage;
  3. import javafx.event.ActionEvent;
  4. import javafx.event.EventHandler;
  5. import javafx.scene.Scene;
  6. import javafx.scene.control.Label;
  7. import javafx.scene.control.Button;
  8. import javafx.scene.layout.StackPane;
  9. import javafx.scene.layout.VBox; //error appears after the semicolon on this line
  10.  
  11. public class Main extends Application {
  12.  
  13. Scene s1, s2;
  14.  
  15. public static void main(String[] args) {
  16. launch(args);
  17. }
  18.  
  19. @Override
  20. public void start(Stage window) {
  21. Label label1 = new Label("s1");
  22. Button button1 = new Button("Click for s2");
  23. button1.setOnAction(e -> window.setScene(s2));
  24.  
  25. VBox lay1 = new VBox(50);
  26. lay1.getChildren().addAll(label1, button1);
  27.  
  28. s1 = new Scene(lay1, 500, 500);
  29.  
  30. Button button2 = new Button("Click for s1");
  31. button2.setOnAction(e -> window.setScene(s1));
  32.  
  33. s2 = new Scene(lay1, 300, 250);
  34.  
  35. window.setScene(s1);
  36. window.setTitle("title");
  37. window.show();
  38. }
  39. }
Add Comment
Please, Sign In to add comment