Advertisement
Guest User

Untitled

a guest
Jun 25th, 2019
79
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.72 KB | None | 0 0
  1. public void start(Stage primaryStage) throws Exception {
  2.  
  3. primaryStage.setTitle("title");
  4.  
  5.  
  6.  
  7. Button btn1 = new Button("new");
  8. Button btn2 = new Button ("continue");
  9.  
  10. btn1.setOnAction(this);
  11. btn2.setOnAction(this);
  12.  
  13.  
  14.  
  15. VBox vb = new VBox (btn1, btn2);
  16. vb.setSpacing(10);
  17. vb.setPadding(new Insets(20));
  18.  
  19.  
  20. BorderPane root = new BorderPane();
  21. root.setBottom(vb);
  22.  
  23. Scene scene = new Scene (root, 300, 250);
  24. primaryStage.setScene(scene);
  25. primaryStage.show();
  26. }
  27.  
  28.  
  29. @Override
  30. public void handle(ActionEvent event) {
  31.  
  32. if (event.getSource()==btn1) {
  33. System.out.println("new!");
  34. } else if (event.getSource()==btn2) {
  35. System.out.println("continue!");
  36. }
  37. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement