Advertisement
Xzempt

Untitled

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