José
José

Reputation: 3179

JFXPanel drag and drop

I have a JPanel with two components. one is a JFXPanel and JLabel, when i drag items from a JTree in a separate windows i get a NPE exception

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)

If i remove the JFXPanel i don't get any exceptions, When the JFXPanel is present the exception happens when i drop elements to the JLabel or the JFXPanel.

I do drag & drop by implementing my TransferHandler, and intalled it into the JLalbel, calling setTransferHandler.

I have try to set a transfer handler in the JFXPanel that always return false from canImport but this doesn't make any difference.

any ideas to fix or workaround this?

Using: Java(TM) SE Runtime Environment (build 1.7.0_06-b24) on a Linux box

Upvotes: 0

Views: 615

Answers (1)

Sergey Grinev
Sergey Grinev

Reputation: 34528

There is a Jira issue to track that problem: 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.

Upvotes: 3

Related Questions