【发布时间】:2015-01-29 04:30:39
【问题描述】:
我正在使用 JComboBox 作为我的一个 JTbale 列的单元格编辑器。我想在我的 JComboBox 中实现自动完成功能。我使用了来自此链接here 的 jar 文件。当我运行我的程序时,它给了我这个错误:
at Exception in thread "AWT-EventQueue-0" java.lang.VerifyError: (class: org/jdesktop/swingx/autocomplete/Configurator, method: enableAutoCompletion signature: (Ljavax/swing/JComboBox;)V) Incompatible argument to functionquotationTable.DescriptionColumnEditor.populateComboBox(DescriptionColumnEditor.java:68)
at quotationTable.DescriptionColumnEditor.<init>(DescriptionColumnEditor.java:31)
at quotationTable.Table.initComponent(Table.java:40)
at quotationTable.Table.<init>(Table.java:28)
at quotationInterface.TablePane.addTable(TablePane.java:40)
at quotationInterface.TablePane.<init>(TablePane.java:25)
at quotationInterface.QuotationTabPane.createQuotPane(QuotationTabPane.java:35)
at quotationInterface.QuotationTabPane.<init>(QuotationTabPane.java:23)
at quotationInterface.MainWindow.<init>(MainWindow.java:37)
at quotationInterface.MainWindow.lambda$main$0(MainWindow.java:90)
at quotationInterface.MainWindow$$Lambda$1/798154996.run(Unknown Source)
at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:311)
at java.awt.EventQueue.dispatchEventImpl(EventQueue.java:744)
at java.awt.EventQueue.access$400(EventQueue.java:97)
at java.awt.EventQueue$3.run(EventQueue.java:697)
at java.awt.EventQueue$3.run(EventQueue.java:691)
at java.security.AccessController.doPrivileged(Native Method)
at java.security.ProtectionDomain$1.doIntersectionPrivilege(ProtectionDomain.java:75)
at java.awt.EventQueue.dispatchEvent(EventQueue.java:714)
at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:201)
at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:116)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:105)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:101)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:93)
at java.awt.EventDispatchThread.run(EventDispatchThread.java:82)
我已经导入了正确的 jar;当我检查这个问题here 时,我确认了这一点。我添加所需功能的代码是:
combo=new JComboBox(myList);
Configurator.enableAutoCompletion(myComboBox); //this is the line generating the error.
我们如何解决这个问题?
我怀疑这条线JComboBox comboBox = [...]; 它是做什么的?可能是我以错误的方式创建组合框。
【问题讨论】:
-
请向我们展示整个堆栈跟踪。
-
就是代码。您已经获得了堆栈跟踪的一部分,我们只需要查看其余部分(顶部?)。
-
好吧,这里漏掉了一些东西......我添加了顶行
-
你在导入什么?
-
我要求在您的班级顶部查看您的导入语句。如果您只是发布MCVE,这会容易得多。
标签: java swing autocomplete jcombobox