How to increase height of JavaFx ControlsFx autocomplete suggestion list?

When I increase the font size of the Autocomplete TextField using CSS or Java, the Autocompleted suggestion list does not increase in height to fit the expanded text.

screenshot

Also, the popup does not appear below the TextField. It works fine until I increase the font size.

I've tried using padding and margin adjustments, but it didn't work. How to increase the height of the autocomplete suggestion list?

+3


source to share


1 answer


Autocomplete from ControlFX is the binding of lists to a TextProperty, so if you need to increase the maximum of autocomplete, you should set the number of visible rows in the ListView like this:

TextFields.bindAutoCompletion(SearchSuppEmp, employeesProvider).setVisibleRowCount(10);

      

SearchSuppEmp

: this is a text box



employeesProvider

: is a collection of items

This is a sample code (search for employees in a company):

Set<String> getAllEmployees() {
        Set<String> autoCompletions = new HashSet<>();
        new EMPDao().FindAll().forEach(employee -> {
            autoCompletions.add(employee.getNFile());
            autoCompletions.add(employee.getLName() + "  " + employee.getFName());
        });
        return autoCompletions;
    }




void initEmployeesSuggestions() {

        employeesProvider = SuggestionProvider.create(getAllEmployees());
        TextFields.bindAutoCompletion(SearchSuppEmp, employeesProvider).setVisibleRowCount(10);
   }

      

0


source







All Articles