import javafx.application.Application; import javafx.geometry.Insets; import javafx.stage.Stage; import javafx.scene.Scene; import javafx.scene.control.Button; import javafx.scene.control.CheckBox; import javafx.scene.layout.VBox; public class App extends Application { public static void main(String[] args) { launch(args); } @Override public void start(Stage primaryStage) throws Exception { CheckBox checkbox1 = new CheckBox("Emese"); CheckBox checkbox2 = new CheckBox("Béla"); Button button = new Button("Dupla"); checkbox1.setSelected(true); button.setOnAction(e -> { if (checkbox1.isSelected()) { System.out.println("Emese ok"); } if (checkbox2.isSelected()) { System.out.println("Béla ok"); } }); VBox vbox = new VBox(10); vbox.setPadding(new Insets(10, 10, 10, 10)); vbox.getChildren().addAll(checkbox1, checkbox2, button); Scene scene = new Scene(vbox, 300, 250); primaryStage.setScene(scene); primaryStage.show(); } }