code: private void processXEvent(X.XEvent event,
                                 RunnableProcessor runnableProcessor) {
          switch (X.XEvent.getType(event.p)) {
              case X.ButtonPress: {
                  X.XButtonEvent buttonEvent = new X.XButtonEvent(event);
                  int button = X.XButtonEvent.getButton(buttonEvent.p);
                  runnableProcessor.invokeLater(new ButtonPressProcessor(button));
                  break;
              }
              case X.ButtonRelease: {
                  X.XButtonEvent buttonEvent = new X.XButtonEvent(event);
                  int button = X.XButtonEvent.getButton(buttonEvent.p);
                  runnableProcessor.invokeLater(
                          new ButtonReleaseProcessor(button));
                  break;
              }
              case X.MotionNotify: {
                  X.XMotionEvent motionEvent = new X.XMotionEvent(event);
                  int x = X.XMotionEvent.getX(motionEvent.p);
                  int y = X.XMotionEvent.getY(motionEvent.p);
                  runnableProcessor.invokeLater(new MotionProcessor(x, y));
                  break;
              }
          }
      }
docs: Dispatch the X Event to the appropriate processor.  All processors run
  via invokeLater
  @param event
  @param runnableProcessor