import javafx.application.Application; import javafx.stage.Stage; import javafx.scene.Scene; import javafx.scene.layout.StackPane; import javafx.scene.control.Button; import javafx.event.ActionEvent; import javafx.event.EventHandler; public class App extends Application { @Override public void start(Stage stage) { Button button = new Button("Katt"); button.setOnAction(new EventHandler() { @Override public void handle(ActionEvent event) { System.out.println("Kattintás volt"); } }); StackPane root = new StackPane(); root.getChildren().add(button); Scene scene = new Scene(root, 300, 250); stage.setScene(scene); stage.setTitle("Valami"); stage.show(); } public static void main(String[] args) { launch(args); } }