import java.time.LocalDate; import javafx.application.Application; import javafx.collections.FXCollections; import javafx.scene.Scene; import javafx.scene.control.ComboBox; import javafx.scene.control.DatePicker; import javafx.scene.layout.VBox; import javafx.stage.FileChooser; import javafx.stage.Stage; public class RT38288 extends Application { @Override public void start(Stage stage) throws Exception { DatePicker datePicker = new DatePicker(LocalDate.now()); ComboBox comboBox = new ComboBox(FXCollections.observableArrayList("A", "B")); comboBox.setEditable(true); stage.setScene(new Scene(new VBox(datePicker, comboBox), 300, 200)); stage.show(); datePicker.setOnAction(e -> { if (stage.isShowing()) { new FileChooser().showOpenDialog(stage); } }); comboBox.setOnAction(e -> { if (stage.isShowing()) { new FileChooser().showOpenDialog(stage); } }); } }