import javafx.application.Application; import javafx.stage.Stage; import javafx.scene.Scene; import javafx.scene.control.Button; import javafx.scene.layout.StackPane; import javafx.scene.layout.VBox; public class App extends Application { public static void main(String[] args) { launch(args); } @Override public void start(Stage stage) { Button button1 = new Button("Felső"); Button button2 = new Button("Alsó"); button1.setOnAction(e -> onButton1Click()); button1.setOnAction(e -> onButton2Click()); StackPane root = new StackPane(); VBox vbox = new VBox(10); vbox.getChildren().addAll(button1, button2); root.getChildren().add(vbox); Scene scene = new Scene(root, 300, 250); stage.setScene(scene); stage.setTitle("Valami"); stage.show(); } private void onButton1Click() { System.out.println("1-s gomb kattintás"); } private void onButton2Click() { System.out.println("2-s gomb kattintás"); } }