0

I have a Java program I wrote for my kids that allows them to paint a circle on a JPanel with the left mouse button, and then remove the circle by clicking with the right mouse button within the circle they created. Here is the code for the MouseListener:

addMouseListener(new MouseAdapter() {
            @Override
            public void mouseClicked(MouseEvent e) {
                switch (e.getButton()) {
                case MouseEvent.BUTTON1:
                    addCircle(e.getPoint());
                    break;
                case MouseEvent.BUTTON2:
                    // this does nothing
                    break;
                case MouseEvent.BUTTON3:
                    removeCircle(e.getPoint());
                    break;
                default:
                    // no default action
                }
            }
        });

The program works fine with a regular mouse, but when using the MacBook multi-touch pad, the four finger swipe throws a JavaNativeException:

java[15233:507] Lookup: Unhandled exception 'JavaNativeException' caught in __57+[LULookupDefinitionModule _focusTermUsingQueue:handler:]_block_invoke

I tried wrapping in the generic Exception, but the JavaNativeException is still getting through.

Is this something that can be resolved without a third-party multi-touch library? It doesn't terminate the program, so my kids don't care. It's more of an academic question for me.

Vadim Kotov
  • 8,084
  • 8
  • 48
  • 62
  • Can you post the full stacktrace of the `JavaNativeException` that is thrown? – Craig Otis Jan 31 '14 at 18:31
  • @CraigOtis - That is what is coming up in the Eclipse console. Since the exception gets through an `Exception` try/catch, `catch (Exception e) {e.printStackTrace();}` is never reached and generates no output. Is there another way to print a more detailed stacktrace that I don't know? – Chris Barrett Jan 31 '14 at 18:41

0 Answers0