public static <T> T showChoicePopup( String title, String header, String content, List<T> choiceList) { T retVal = null; ChoiceDialog<T> dialog = new ChoiceDialog<>(choiceList.get(0), choiceList); dialog.setTitle(title); dialog.setHeaderText(header); dialog.setContentText(content); Optional<T> result = dialog.showAndWait(); if (!result.equals(Optional.<T>empty())) { retVal = result.get(); } return retVal; }