How to implement AutoComplete TextField using ControlsFX

I use the latest version (8.0.5) of ControlsFX, and I think I need a little help with TextField autocomplete, because I'm very new to this.

I got this code here

AutoCompletionTextFieldBinding.createBinding(
MyTxtField,
SuggestionProvider.create("Hey", "Hello", "Hello World", "Apple", "Cool", "Costa", "Cola", "Coca Cola")
);

But it shows an error: method SuggestionProvider is not applicable.

Any tips on implementing this autocomplete to have an array similar to a dictionary with IDand VALUE?

+4
source share
2 answers

, https://bitbucket.org/controlsfx/controlsfx/pull-request/196/auto-complete-support-see-127/diff ( ) fx 8.05 4 http://fxexperience.com/controlsfx/, , , , , , , , API, . - , 8.05

TextFields.bindAutoCompletion(
            textField,
            "Hey", "Hello", "Hello World", "Apple", "Cool", "Costa", "Cola", "Coca Cola");

API, , IDE

controlfx 8.05, , :}

+7

AutoCompletionTextFieldBinding :

TextField textField = new TextField();
new AutoCompletionTextFieldBinding(textField, new Callback<AutoCompletionBinding.ISuggestionRequest, Collection>() {
    @Override
    public Collection call(AutoCompletionBinding.ISuggestionRequest param) {
        return Arrays.asList("Option 1", "Option 2");
    }
});
+2

Source: https://habr.com/ru/post/1534162/


All Articles