Advertisement
Xzempt

Untitled

Jun 6th, 2013
47
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 1.37 KB | None | 0 0
  1. package HelloWorld;
  2.  
  3.  
  4. import javafx.application.Application;
  5. import javafx.event.ActionEvent;
  6. import javafx.event.EventHandler;
  7. import javafx.scene.Scene;
  8. import javafx.scene.control.Button;
  9. import javafx.scene.layout.StackPane;
  10. import javafx.stage.Stage;
  11.  
  12. public class HelloWorld extends Application {
  13.     public static void main(String[] args) {
  14.         launch(args);
  15.     }
  16.  
  17.     @Override
  18.     public void start(Stage primaryStage) {
  19.         primaryStage.setTitle("Tit's or GTFO!");
  20.         final Button btn = new Button();
  21.         btn.setText("Yes");
  22.         btn.setOnAction(new EventHandler<ActionEvent>() {
  23.  
  24.             @Override
  25.             public void handle(ActionEvent event) {
  26.                 btn.setText("Link please!");
  27.             }
  28.         });
  29.         final Button nobtn = new Button();
  30.         nobtn.setText("No");
  31.         nobtn.setOnAction(new EventHandler<ActionEvent>() {
  32.  
  33.             public void handle(ActionEvent event) {
  34.                 nobtn.setText("GTFO!");
  35.             }
  36.  
  37.         });
  38.  
  39.         StackPane root = new StackPane();
  40.         root.getChildren().add(btn);
  41.         primaryStage.setScene(new Scene(root, 300, 250));
  42.         primaryStage.show();
  43.  
  44.  
  45.  
  46.         StackPane stack = new StackPane();
  47.         stack.getChildren().add(nobtn);
  48.         primaryStage.setScene(new Scene(stack, 400, 350));
  49.         primaryStage.show();
  50.     }
  51. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement