document.write('
Data hosted with ♥ by Pastebin.com - Download Raw - See Original
  1. package HelloWorld;
  2.  
  3. import javafx.application.Application;
  4. import javafx.event.ActionEvent;
  5. import javafx.event.EventHandler;
  6. import javafx.scene.Group;
  7. import javafx.scene.Scene;
  8. import javafx.scene.control.Button;
  9. import javafx.scene.control.Label;
  10. import javafx.stage.Stage;
  11.  
  12. public class HelloWorld extends Application {
  13.  
  14. Button btn = new Button();
  15. Label lbl = new Label();
  16.  
  17. public static void main(String[] args) {
  18. launch(args);
  19. }
  20.  
  21. @Override
  22. public void start(Stage primaryStage) {
  23. primaryStage.setTitle("Hello World!");
  24.  
  25. lbl.setLayoutX(70);
  26. lbl.setLayoutY(150);
  27.  
  28. btn.setLayoutX(100);
  29. btn.setLayoutY(100);
  30. btn.setText("Hello, World!");
  31.  
  32.  
  33. btn.setOnAction(new EventHandler<ActionEvent>() {
  34.  
  35. @Override
  36. public void handle(ActionEvent event) {
  37. //System.out.println("Hello World!");
  38. lbl.setText("Click'd on button Hello, World.");
  39. }
  40. });
  41.  
  42. Group root = new Group();
  43.  
  44. root.getChildren().add(btn);
  45. root.getChildren().add(lbl);
  46. primaryStage.setScene(new Scene(root, 300, 250));
  47. primaryStage.show();
  48. }
  49. }
');