使用跳跃运动控制器单击按钮后,Swing应用程序崩溃

时间:2013-09-18 08:44:50

标签: java swing leap-motion

我尝试编写一个小型swing应用程序,在其中我使用跳跃运动控制器移动鼠标(这可以工作),然后通过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的自定义构造函数获取JButton形式的GUI-Class。它看起来像这样:

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();但这也不起作用。

0 个答案:

没有答案