https://github.com/gbfragoso/autofillcombobox
https://github.com/gbfragoso/autofillcombobox
javafx javafx-8 javafx-components javafx-library
Last synced: 7 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/gbfragoso/autofillcombobox
- Owner: gbfragoso
- Archived: true
- Created: 2017-08-04T02:12:56.000Z (over 8 years ago)
- Default Branch: master
- Last Pushed: 2017-08-04T02:14:20.000Z (over 8 years ago)
- Last Synced: 2025-03-14T06:12:45.590Z (9 months ago)
- Topics: javafx, javafx-8, javafx-components, javafx-library
- Language: Java
- Size: 1.95 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# AutoFillCombobox
An simple autofill approach to extend the default JavaFX's combobox behavior.
# Motivation
The default combobox component of JavaFX dont offer a option to query his list of items. This code is a powerful solution to this problem.
# Assumptions
* You has an ordered list of strings
# Performance tips
* For type safe reasons we use .toLowerCase() function at input string and on search. If your list contains only upper/lower case strings you can remove the .toLowerCase() from search.
items.stream().filter(p -> p.**toLowerCase()**.startsWith(lower)).findFirst();
# Code Example
With a predefined list:
```java
ObservableList items = FXCollections.observableArrayList();
// Add items to list
AutoFillComboBox autoFill = new AutoFillComboBox(items);
```
Without a predefined list of items:
```java
AutoFillComboBox autoFill = new AutoFillComboBox();
// some code
ObservableList items = FXCollections.observableArrayList();
autoFill.setItems(items);
autoFill.setAutoFill(true);
```