0

我尝试编写一个小型摇摆应用程序,在该应用程序中,我使用跳跃运动控制器移动鼠标(这可行),然后通过 Screen-Tap-Gesture 单击按钮。它的作用是显示该按钮已被单击,但随后应用程序在控制台上出现此输出而崩溃:

 A fatal error has been detected by the Java Runtime Environment:

  EXCEPTION_ACCESS_VIOLATION (0xc0000005) at pc=0x00000000678f09fc, pid=3796, tid=2124

 JRE version: 7.0_21-b11
 Java VM: Java HotSpot(TM) 64-Bit Server VM (23.21-b01 mixed mode windows-amd64 compressed oops)
 Problematic frame:
 V  [jvm.dll+0x1b09fc]

 Failed to write core dump. Minidumps are not enabled by default on client versions of Windows

 If you would like to submit a bug report, please visit:
   http://bugreport.sun.com/bugreport/crash.jsp

这是我在 LeapListener 类中的鼠标点击代码:

GestureList gList = frame.gestures();
    for (int i = 0; i < gList.count(); i++){
        Gesture g = gList.get(i);

        if (g.type().equals(Gesture.Type.TYPE_SCREEN_TAP)){
            @SuppressWarnings("unused")
            ScreenTapGesture tap = new ScreenTapGesture(g);
            System.out.println("geklickt");
            this.getButton().doClick();
        }
    }

LeapListener 的自定义 cunstructor 从 GUI-Class 获取 JButton。它看起来像这样:

button = new JButton("Close");
    button.setSize(100, 40);
    button.addActionListener(new ActionListener() {

        @Override
        public void actionPerformed(ActionEvent e) {
            if (e.equals("Close")){
                dispose();
            }

        }
    });

那有什么问题?编辑:我使用了 mKorbel 的提示(谢谢)并尝试了 System.exit(0); 而不是 dispose(); 但这也不起作用。

4

0 回答 0