I trying to build the text dialog where the user enter the event name, event size, and the selected the venue.
My problem is in how can I gather the inputs; here what I did so far:
eventName = new TextField();
eventSize = new TextField();
ObservableList<Venue> options =
FXCollections.observableArrayList(model.getVenuesList());
VeunueList = new ComboBox<Venue>(options);
I create a class that encapsulate all my inputs:
public class MyResult {
String eventname;
String eventsize;
Venue venue;
}
I define the variable to be object of class Myresult
:
private Dialog<MyResult> dialog ;
private Optional<MyResult> EventInput;
The problem is how to write return statement in the result converter; it gives me error:
dialog.setResultConverter(dialogButton -> {
if (dialogButton == submit) {
return new MyResult(eventName.getText(),eventSize.getText(),VeunueList.getValue())
}
return null;
});
EventInput = dialog.showAndWait();
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…