0

I try to write a small swing application in which I move the mouse with the leap motion controller (this works) and click on a button via Screen-Tap-Gesture. What it does is to show that the button is clicked but then the application crashes with this output on the console:

 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

This is my code for the mouseclick in my LeapListener Class:

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();
        }
    }

The custom cunstructor of the LeapListener gets the JButton form the GUI-Class. There it looks like this:

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

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

        }
    });

What's wrong with that? EDIT: I used the hint of mKorbel (thank you) and tried System.exit(0); instead of dispose(); but that doesn't work either.

Raistlin
  • 997
  • 2
  • 11
  • 33
  • whats happens in the case that dispose(); should be linked, with reference to local variable for Top-level Container, e.g. myFrame.dispose(), – mKorbel Sep 18 '13 at 08:48
  • Strange, when I do this, it says that frame has no dispose method. By the way, I use JFrame as parent class for my gui. – Raistlin Sep 18 '13 at 08:53
  • 1
    for better help sooner post an [SSCCE](http://sscce.org/), short, runnable, compilable, just about JFrame with JButton caused a.m. issue, – mKorbel Sep 18 '13 at 08:57

0 Answers0