将ControlFX TableFilter添加到TableView NoSuchMethodException错误

时间:2018-01-31 13:10:48

标签: javafx nosuchmethoderror controlsfx tablefilter

在将TableView指向ControlFX TableFilter

时出现执行错误

代码

  ...

 Platform.runLater(new Runnable() {

                    public void run() {

                        for (int i = 0 ; i < columnNames.size() ; i++) {  
                            tblSearch.getColumns().add((TableColumn<List<Object>, Object>) columnNames.get(i));

                        }

                        tblSearch.getItems().setAll(dataFromCommonDAO.getData());

                        //Adding the filter option to the table
                        TableFilter.forTableView(tblSearch).apply();
                    }
                });
 ...

运行应用程序并在重新加载表的数据时,有时会出现以下错误,但仍然可以使用过滤器并且表重新加载正常。

 java.lang.NoSuchMethodException: javafx.scene.control.skin.TableViewSkin.getTableHeaderRow()
at java.base/java.lang.Class.getDeclaredMethod(Class.java:2432)
at impl.org.controlsfx.ReflectionUtils.getTableHeaderRowFrom(ReflectionUtils.java:173)
at impl.org.controlsfx.table.FilterPanel.checkChangeContextMenu(FilterPanel.java:225)
at impl.org.controlsfx.table.FilterPanel.lambda$new$1(FilterPanel.java:87)
at javafx.base/javafx.beans.value.WeakChangeListener.changed(WeakChangeListener.java:89)
at javafx.base/com.sun.javafx.binding.ExpressionHelper$Generic.fireValueChangedEvent(ExpressionHelper.java:360)
at javafx.base/com.sun.javafx.binding.ExpressionHelper.fireValueChangedEvent(ExpressionHelper.java:80)
at javafx.base/javafx.beans.property.ObjectPropertyBase.fireValueChangedEvent(ObjectPropertyBase.java:106)
at javafx.base/javafx.beans.property.ObjectPropertyBase.markInvalid(ObjectPropertyBase.java:113)
at javafx.base/javafx.beans.property.ObjectPropertyBase.set(ObjectPropertyBase.java:147)
at javafx.graphics/javafx.css.StyleableObjectProperty.set(StyleableObjectProperty.java:82)
at javafx.controls/javafx.scene.control.Control$2.set(Control.java:250)
at javafx.controls/javafx.scene.control.Control$2.set(Control.java:233)
at javafx.controls/javafx.scene.control.Control.doProcessCSS(Control.java:899)
at javafx.controls/javafx.scene.control.Control.access$000(Control.java:83)
at javafx.controls/javafx.scene.control.Control$1.doProcessCSS(Control.java:89)
at javafx.controls/com.sun.javafx.scene.control.ControlHelper.processCSSImpl(ControlHelper.java:67)
at javafx.graphics/com.sun.javafx.scene.NodeHelper.processCSS(NodeHelper.java:147)
at javafx.graphics/javafx.scene.Parent.doProcessCSS(Parent.java:1419)
at javafx.graphics/javafx.scene.Parent.access$400(Parent.java:81)
at javafx.graphics/javafx.scene.Parent$1.doProcessCSS(Parent.java:127)
at javafx.graphics/com.sun.javafx.scene.ParentHelper.processCSSImpl(ParentHelper.java:100)
at javafx.graphics/com.sun.javafx.scene.NodeHelper.processCSS(NodeHelper.java:147)
at javafx.graphics/javafx.scene.Node.processCSS(Node.java:9513)
at javafx.graphics/javafx.scene.Node.processCSS(Node.java:9506)
at javafx.graphics/javafx.scene.Node.processCSS(Node.java:9506)
at javafx.graphics/javafx.scene.Scene.doCSSPass(Scene.java:583)
at javafx.graphics/javafx.scene.Scene.access$3500(Scene.java:173)
at javafx.graphics/javafx.scene.Scene$ScenePulseListener.pulse(Scene.java:2502)
at javafx.graphics/com.sun.javafx.tk.Toolkit.lambda$runPulse$2(Toolkit.java:410)
at java.base/java.security.AccessController.doPrivileged(Native Method)
at javafx.graphics/com.sun.javafx.tk.Toolkit.runPulse(Toolkit.java:409)
at javafx.graphics/com.sun.javafx.tk.Toolkit.firePulse(Toolkit.java:436)
at javafx.graphics/com.sun.javafx.tk.quantum.QuantumToolkit.pulse(QuantumToolkit.java:518)
at javafx.graphics/com.sun.javafx.tk.quantum.QuantumToolkit.pulse(QuantumToolkit.java:498)
at javafx.graphics/com.sun.javafx.tk.quantum.QuantumToolkit.pulseFromQueue(QuantumToolkit.java:491)
at javafx.graphics/com.sun.javafx.tk.quantum.QuantumToolkit.lambda$runToolkit$11(QuantumToolkit.java:319)
at javafx.graphics/com.sun.glass.ui.InvokeLaterDispatcher$Future.run(InvokeLaterDispatcher.java:96)
at javafx.graphics/com.sun.glass.ui.win.WinApplication._runLoop(Native Method)
at javafx.graphics/com.sun.glass.ui.win.WinApplication.lambda$runLoop$3(WinApplication.java:175)
at java.base/java.lang.Thread.run(Thread.java:844)

我在使用此代码时也遇到此错误:

 Platform.runLater(new Runnable() {

                    public void run() {

                        for (int i = 0 ; i < columnNames.size() ; i++) {  
                            tblSearch.getColumns().add((TableColumn<List<Object>, Object>) columnNames.get(i));
                            //tblTareas.getColumns().get(i).setText(columnNamesShowList.get(i));
                        }

                        tblSearch.getItems().setAll(dataFromCommonDAO.getData());

                        //TableFilter.forTableView(tblSearch).apply();
                        Builder<List<Object>> tblSearchBuilder= TableFilter.forTableView(tblSearch);
                        tblSearchBuilder.apply();
                    }
                });

在配置ControlFX TableFilter的任何方式时,有什么我遗漏或出错的地方吗?

0 个答案:

没有答案