Reputation: 1107
I have a dialog with few textfields. I want dialog to return these result as a list of String. Here is an example how to return a Pair of String:
dialog.setResultConverter(dialogButton -> {
return new Pair<>(slotRequired.getText(), baseOffset.getText());
});
Do you know how to do it with a list of String ?
Upvotes: 0
Views: 169
Reputation: 209339
Make the dialog a Dialog<List<String>>
and do
dialog.setResultConverter(dialogButton -> {
List<String> result = new ArrayList<>();
result.add(slotRequired.getText());
result.add(baseOffset.getText());
// add as many times as you need...
return result ;
});
or, more succinctly:
dialog.setResultConverter(dialogButton ->
Arrays.asList(slotRequired.getText(), baseOffset.getText() /*, as many as you need...*/));
Upvotes: 1