简体   繁体   English

DragAndDrop java.lang.RuntimeException

[英]DragAndDrop java.lang.RuntimeException

I am learning Drag and Drop, but for every single example that I want to study, I get the folowing exception java.lang.RuntimeException: cannot load system cursor: CopyDrop.32x32 . 我正在学习拖放,但是对于每个要学习的示例,我都会得到以下异常java.lang.RuntimeException: cannot load system cursor: CopyDrop.32x32 Does anyone know what is the meaning of this exception and how can I fix it? 有谁知道此异常的含义,我该如何解决? Even with this example I get that exception. 即使在这个例子中,我也得到了例外。

java.lang.RuntimeException: cannot load system cursor: CopyDrop.32x32 at sun.awt.windows.WToolkit.lazilyLoadDesktopProperty(Unknown Source) at java.awt.Toolkit.getDesktopProperty(Unknown Source) at java.awt.dnd.DragSource.load(Unknown Source) at java.awt.dnd.DragSource.<clinit>(Unknown Source) at javax.swing.plaf.basic.DragRecognitionSupport.mousePressedImpl(Unknown Source) at javax.swing.plaf.basic.DragRecognitionSupport.mousePressed(Unknown Source) at javax.swing.plaf.basic.BasicListUI$Handler.mousePressed(Unknown Source) at java.awt.AWTEventMulticaster.mousePressed(Unknown Source) at java.awt.Component.processMouseEvent(Unknown Source) at javax.swing.JComponent.processMouseEvent(Unknown Source) at java.awt.Component.processEvent(Unknown Source) at java.awt.Container.processEvent(Unknown Source) at java.awt.Component.dispatchEventImpl(Unknown Source) at java.awt.Container.dispatchEventImpl(Unknown Source) at java.awt.Component.dispatchEvent(Unknown Source) at java.awt.LightweightDispatcher.retargetMouseEvent(Unknown Source) at java.awt.LightweightDispatcher.processMouseEvent(Unknown Source) at java.awt.LightweightDispatcher.dispatchEvent(Unknown Source) at java.awt.Container.dispatchEventImpl(Unknown Source) at java.awt.Window.dispatchEventImpl(Unknown Source) at java.awt.Component.dispatchEvent(Unknown Source) at java.awt.EventQueue.dispatchEventImpl(Unknown Source) at java.awt.EventQueue.access$500(Unknown Source) at java.awt.EventQueue$3.run(Unknown Source) at java.awt.EventQueue$3.run(Unknown Source) at java.security.AccessController.doPrivileged(Native Method) at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(Unknown Source) at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(Unknown Source) at java.awt.EventQueue$4.run(Unknown Source) at java.awt.EventQueue$4.run(Unknown Source) at java.security.AccessController.doPrivileged(Native Method) at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(Unknown Source) at java.awt.EventQueue.dispatchEvent(Unknown Source) at java.awt.EventDispatchThread.pumpOneEventForFilters(Unknown Source) at java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source) at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source) at java.awt.EventDispatchThread.pumpEvents(Unknown Source) at java.awt.EventDispatchThread.pumpEvents(Unknown Source) at java.awt.EventDispatchThread.run(Unknown Source) Caused by: java.awt.AWTException: Exception: class java.security.PrivilegedActionException null occurred while loading: C:\\Program Files\\Java\\jre1.8.0_101\\lib\\images\\cursors\\cursors.properties at java.awt.Cursor.loadSystemCustomCursorProperties(Unknown Source) at java.awt.Cursor.getSystemCustomCursor(Unknown Source) ... 39 more Exception in thread "AWT-EventQueue-0" java.lang.ExceptionInInitializerError at javax.swing.plaf.basic.DragRecognitionSupport.mousePressedImpl(Unknown Source) at javax.swing.plaf.basic.DragRecognitionSupport.mousePressed(Unknown Source) at javax.swing.plaf.basic.BasicListUI$Handler.mousePressed(Unknown Source) at java.awt.AWTEventMulticaster.mousePressed(Unknown Source) at java.awt.Component.processMouseEvent(Unknown Source) at javax.swing.JComponent.processMouseEvent(Unknown Source) at java.awt.Component.processEvent(Unknown Source) at java.awt.Container.processEvent(Unknown Source) at java.awt.Component.dispatchEventImpl(Unknown Source) at java.awt.Container.dispatchEventImpl(Unknown Source) at java.awt.Component.dispatchEvent(Unknown Source) at java.awt.LightweightDispatcher.retargetMouseEvent(Unknown Source) at java.awt.LightweightDispatcher.processMouseEvent(Unknown Source) at java.awt.LightweightDispatcher.dispatchEvent(Unknown Source) at java.awt.Container.dispatchEventImpl(Unknown Source) at java.awt.Window.dispatchEventImpl(Unknown Source) at java.awt.Component.dispatchEvent(Unknown Source) at java.awt.EventQueue.dispatchEventImpl(Unknown Source) at java.awt.EventQueue.access$500(Unknown Source) at java.awt.EventQueue$3.run(Unknown Source) at java.awt.EventQueue$3.run(Unknown Source) at java.security.AccessController.doPrivileged(Native Method) at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(Unknown Source) at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(Unknown Source) at java.awt.EventQueue$4.run(Unknown Source) at java.awt.EventQueue$4.run(Unknown Source) at java.security.AccessController.doPrivileged(Native Method) at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(Unknown Source) at java.awt.EventQueue.dispatchEvent(Unknown Source) at java.awt.EventDispatchThread.pumpOneEventForFilters(Unknown Source) at java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source) at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source) at java.awt.EventDispatchThread.pumpEvents(Unknown Source) at java.awt.EventDispatchThread.pumpEvents(Unknown Source) at java.awt.EventDispatchThread.run(Unknown Source) Caused by: java.lang.RuntimeException: failed to load system cursor: DnD.Cursor.CopyDrop : cannot load system cursor: CopyDrop.32x32 at java.awt.dnd.DragSource.load(Unknown Source) at java.awt.dnd.DragSource.<clinit>(Unknown Source) ... 35 more

I have a minimal example ,I get same exception. 我有一个最小的例子,我也有同样的例外。

    public DragAndDrop() {
    setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    setBounds(100, 100, 450, 300);
    contentPane = new JPanel();
    contentPane.setBorder(new EmptyBorder(5, 5, 5, 5));
    contentPane.setLayout(new BorderLayout(0, 0));
    setContentPane(contentPane);
    TransferHandler transfer = new TransferHandler("text");

    JPanel panel = new JPanel();
    contentPane.add(panel, BorderLayout.CENTER);

    JTextArea textArea = new JTextArea();
    textArea.setDragEnabled(true);
    textArea.setTransferHandler(transfer);
}

I solved this problem ! 我解决了这个问题! I had installed jre1.8.0_101, and I upgraded to jre1.8.0_111. 我已经安装了jre1.8.0_101,并已升级到jre1.8.0_111。 If anyone have this issue about DragAndDrop, make sure u have latest version of jre. 如果有人遇到有关DragAndDrop的问题,请确保您具有最新版本的jre。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM