use of impl.org.controlsfx.autocompletion.AutoCompletionTextFieldBinding in project Gargoyle by callakrsos.
the class AutoCompletionTextBindingExam method start.
/* (non-Javadoc)
* @see javafx.application.Application#start(javafx.stage.Stage)
*/
@Override
public void start(Stage primaryStage) throws Exception {
TextField textField = new TextField();
List<String> asList = Arrays.asList("sssss", "aaaaa");
AutoCompletionTextFieldBinding<String> autoCompletionTextFieldBinding = new AutoCompletionTextFieldBinding<>(textField, new Callback<ISuggestionRequest, Collection<String>>() {
@Override
public Collection<String> call(ISuggestionRequest param) {
String userText = param.getUserText();
return asList.stream().filter(v -> v.startsWith(userText)).collect(Collectors.toList());
}
});
autoCompletionTextFieldBinding.setVisibleRowCount(10);
primaryStage.setScene(new Scene(new BorderPane(textField)));
primaryStage.show();
}
Aggregations