I am using javafx-11.0.2 and trying to use autocomplete feature.The code is like this:
@FXML private TextField corporateName;
private Set<String> possibleSuggestion = new HashSet<>(Arrays.asList(_possibleSuggestion));
private String[] _possibleSuggestion ={"Abc Corp", "bbb corp", "jags corp", "test","xuz","hyatt","yak n yeti"};
public void initialize(URL location, ResourceBundle resources) {
TextFields.bindAutoCompletion(corporateName,possibleSuggestion);
}
And the VM options
is as follows:
--module-path /home/development/javafx-sdk-11.0.2/lib$Classpath$
--add-modules javafx.controls,javafx.fxml,javafx.base
--add-exports=javafx.base/com.sun.javafx.event=ALL-UNNAMED
but everytime it is showing error like this :
Caused by: java.lang.IllegalAccessError: class org.controlsfx.control.textfield.AutoCompletionBinding (in module controlsfx) cannot access class com.sun.javafx.event.EventHandlerManager (in module javafx.base) because module javafx.base does not export com.sun.javafx.event to module controlsfx
How can I resolve this error ? Please suggest.
Your issues is that
--add-exports=javafx.base/com.sun.javafx.event=ALL-UNNAMED
works only for JavaFX 9 or less.This is the option you want to use in your VM options.
--add-exports=javafx.base/com.sun.javafx.event=org.controlsfx.controls