/* * To change this template, choose Tools | Templates * and open the template in the editor. */ package test; import javafx.application.Application; import javafx.event.ActionEvent; import javafx.event.EventHandler; import javafx.scene.Cursor; import javafx.scene.Group; import javafx.scene.Scene; import javafx.scene.control.Button; import javafx.scene.paint.Color; import javafx.stage.Stage; /** * * @author Kyle */ public class Test extends Application { /** * @param args the command line arguments */ public static void main(String[] args) { Application.launch(Test.class, args); } @Override public void start(Stage primaryStage) { primaryStage.setTitle("Hello World"); Group root = new Group(); Scene scene = new Scene(root, 300, 250, Color.LIGHTGREEN); Button btn = new Button(); btn.setLayoutX(100); btn.setLayoutY(80); btn.setText("Hello World"); btn.setOnAction(new EventHandler() { public void handle(ActionEvent event) { System.out.println("Hello World"); } }); btn.setCursor(Cursor.MOVE); root.getChildren().add(btn); primaryStage.setScene(scene); primaryStage.setVisible(true); } }