0

我有一个带有两个组件的 JPanel。一个是 JFXPanel 和 JLabel,当我在单独的窗口中从 JTree 中拖动项目时,我得到 NPE 异常

Exception in thread "AWT-EventQueue-0" java.lang.NullPointerException
    at javafx.embed.swing.SwingDnD$2.dragDropEnd(SwingDnD.java:119)
    at java.awt.dnd.DragSource.processDragDropEnd(DragSource.java:769)
    at java.awt.dnd.DragSourceContext.dragDropEnd(DragSourceContext.java:437)
    at sun.awt.dnd.SunDragSourceContextPeer$EventDispatcher.run(SunDragSourceContextPeer.java:491)
    at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:251)
    at java.awt.EventQueue.dispatchEventImpl(EventQueue.java:711)
    at java.awt.EventQueue.access$000(EventQueue.java:104)
    at java.awt.EventQueue$3.run(EventQueue.java:672)
    at java.awt.EventQueue$3.run(EventQueue.java:670)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.security.ProtectionDomain$1.doIntersectionPrivilege(ProtectionDomain.java:76)
    at java.awt.EventQueue.dispatchEvent(EventQueue.java:681)
    at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:244)
    at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:163)
    at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:151)
    at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:147)
    at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:139)
    at java.awt.EventDispatchThread.run(EventDispatchThread.java:97)

如果我删除 JFXPanel 我没有得到任何异常,当 JFXPanel 存在时,当我将元素拖放到 JLabel 或 JFXPanel 时会发生异常。

我通过实现我的 TransferHandler 进行拖放,并将其安装到 JLalbel 中,调用 setTransferHandler。

我尝试在 JFXPanel 中设置一个始终从 canImport 返回 false 的传输处理程序,但这没有任何区别。

有什么想法可以解决或解决这个问题吗?

使用:Linux 机器上的 Java(TM) SE 运行时环境(内部版本 1.7.0_06-b24)

4

1 回答 1

3

有一个 Jira 问题可以跟踪该问题:http: //javafx-jira.kenai.com/browse/RT-21836

Currently it marked as 2.2.2 candidate so you may expect a fix in JavaFX 2.2.2 update. Also you are welcome to vote for it once Jira will be back from maintenance.

于 2012-08-23T10:39:29.003 回答