我正在try 为JavaFX中的ComboBox注册ControlsFX验证器.然后,我得到了与模块系统相关的以下错误.当我try 打开org.Controsfx.Controls模块的javafx.Scene包时,也导致了一个错误.我将添加我在下面得到的所有代码和错误.
这是导致错误的我的代码.
ValidationSupport validationSupport = new ValidationSupport();
validationSupport.registerValidator(prefixCombo, Validator.createEmptyValidator("Combobox selection required!"));
这是我在运行项目时收到的错误.
Exception in thread "JavaFX Application Thread" java.lang.reflect.InaccessibleObjectException: Unable to make protected javafx.collections.ObservableList javafx.scene.Parent.getChildren() accessible: module javafx.graphics does not "opens javafx.scene" to module org.controlsfx.controls
at java.base/java.lang.reflect.AccessibleObject.checkCanSetAccessible(AccessibleObject.java:354)
这是我当前的MODULE-info.Java文件
module system {
requires javafx.controls;
requires javafx.fxml;
requires jakarta.persistence;
requires org.hibernate.orm.core;
requires MaterialFX;
requires org.slf4j;
requires de.jensd.fx.glyphs.fontawesome;
requires static lombok;
requires org.controlsfx.controls;
requires javafx.graphics;
opens com.example.system to javafx.fxml, org.controlsfx.controls;
exports com.example.system;
exports com.example.system.controller;
opens com.example.system.controller to javafx.fxml, javafx.graphics;
opens com.example.system.entity to org.hibernate.orm.core;
opens com.example.system.tm to javafx.base;
}
我try 将opens javafx.scene to org.controlsfx.controls;
添加到MODULE-infor.java中.
然后,导致另一个错误Package not found: javafx.scene
提前感谢大家!!