430 }
431 if (e.isPopupTrigger()) {
432 scenePeer.menuEvent(e.getX(), e.getY(), e.getXOnScreen(), e.getYOnScreen(), false);
433 }
434 }
435
436 /**
437 * Overrides the {@link java.awt.Component#processMouseEvent(MouseEvent)}
438 * method to dispatch the mouse event to the JavaFX scene attached to this
439 * {@code JFXPanel}.
440 *
441 * @param e the mouse event to dispatch to the JavaFX scene
442 */
443 @Override
444 protected void processMouseEvent(MouseEvent e) {
445 if ((e.getID() == MouseEvent.MOUSE_PRESSED) &&
446 (e.getButton() == MouseEvent.BUTTON1)) {
447 if (isFocusable() && !hasFocus()) {
448 requestFocus();
449 // This fixes JDK-8087914 without causing JDK-8200224
450 // It is save, because in JavaFX only the method "setFocused(true)" is called,
451 // which doesn't have any side-effects when called multiple times.
452 int focusCause = AbstractEvents.FOCUSEVENT_ACTIVATED;
453 stagePeer.setFocused(true, focusCause);
454 }
455 }
456
457 sendMouseEventToFX(e);
458 super.processMouseEvent(e);
459 }
460
461 /**
462 * Overrides the {@link java.awt.Component#processMouseMotionEvent(MouseEvent)}
463 * method to dispatch the mouse motion event to the JavaFX scene attached to
464 * this {@code JFXPanel}.
465 *
466 * @param e the mouse motion event to dispatch to the JavaFX scene
467 */
468 @Override
469 protected void processMouseMotionEvent(MouseEvent e) {
470 sendMouseEventToFX(e);
|
430 }
431 if (e.isPopupTrigger()) {
432 scenePeer.menuEvent(e.getX(), e.getY(), e.getXOnScreen(), e.getYOnScreen(), false);
433 }
434 }
435
436 /**
437 * Overrides the {@link java.awt.Component#processMouseEvent(MouseEvent)}
438 * method to dispatch the mouse event to the JavaFX scene attached to this
439 * {@code JFXPanel}.
440 *
441 * @param e the mouse event to dispatch to the JavaFX scene
442 */
443 @Override
444 protected void processMouseEvent(MouseEvent e) {
445 if ((e.getID() == MouseEvent.MOUSE_PRESSED) &&
446 (e.getButton() == MouseEvent.BUTTON1)) {
447 if (isFocusable() && !hasFocus()) {
448 requestFocus();
449 // This fixes JDK-8087914 without causing JDK-8200224
450 // It is safe, because in JavaFX only the method "setFocused(true)" is called,
451 // which doesn't have any side-effects when called multiple times.
452 int focusCause = AbstractEvents.FOCUSEVENT_ACTIVATED;
453 stagePeer.setFocused(true, focusCause);
454 }
455 }
456
457 sendMouseEventToFX(e);
458 super.processMouseEvent(e);
459 }
460
461 /**
462 * Overrides the {@link java.awt.Component#processMouseMotionEvent(MouseEvent)}
463 * method to dispatch the mouse motion event to the JavaFX scene attached to
464 * this {@code JFXPanel}.
465 *
466 * @param e the mouse motion event to dispatch to the JavaFX scene
467 */
468 @Override
469 protected void processMouseMotionEvent(MouseEvent e) {
470 sendMouseEventToFX(e);
|