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.