Java Code Examples for java.awt.event.MouseEvent#MOUSE_EXITED

The following examples show how to use java.awt.event.MouseEvent#MOUSE_EXITED . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: CWarningWindow.java    From jdk8u-jdk with GNU General Public License v2.0 6 votes vote down vote up
@Override
public void notifyMouseEvent(int id, long when, int button, int x, int y,
                             int screenX, int screenY, int modifiers,
                             int clickCount, boolean popupTrigger,
                             byte[] bdata) {
    LWWindowPeer peer = ownerPeer.get();
    if (id == MouseEvent.MOUSE_EXITED) {
        if (peer != null) {
            peer.updateSecurityWarningVisibility();
        }
    } else if(id == MouseEvent.MOUSE_ENTERED) {
        if (peer != null) {
            peer.updateSecurityWarningVisibility();
        }
    }
}
 
Example 2
Source File: XToolkit.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 6 votes vote down vote up
static boolean isRightMouseButton(MouseEvent me) {
    int numButtons = ((Integer)getDefaultToolkit().getDesktopProperty("awt.mouse.numButtons")).intValue();
    switch (me.getID()) {
      case MouseEvent.MOUSE_PRESSED:
      case MouseEvent.MOUSE_RELEASED:
          return ((numButtons == 2 && me.getButton() == MouseEvent.BUTTON2) ||
                   (numButtons > 2 && me.getButton() == MouseEvent.BUTTON3));
      case MouseEvent.MOUSE_ENTERED:
      case MouseEvent.MOUSE_EXITED:
      case MouseEvent.MOUSE_CLICKED:
      case MouseEvent.MOUSE_DRAGGED:
          return ((numButtons == 2 && (me.getModifiersEx() & InputEvent.BUTTON2_DOWN_MASK) != 0) ||
                  (numButtons > 2 && (me.getModifiersEx() & InputEvent.BUTTON3_DOWN_MASK) != 0));
    }
    return false;
}
 
Example 3
Source File: CWarningWindow.java    From jdk8u_jdk with GNU General Public License v2.0 6 votes vote down vote up
@Override
public void notifyMouseEvent(PlatformWindow platformWindow, int id, long when, int button, int x, int y,
                             int screenX, int screenY, int modifiers,
                             int clickCount, boolean popupTrigger,
                             byte[] bdata) {
    LWWindowPeer peer = ownerPeer.get();
    if (id == MouseEvent.MOUSE_EXITED) {
        if (peer != null) {
            peer.updateSecurityWarningVisibility();
        }
    } else if(id == MouseEvent.MOUSE_ENTERED) {
        if (peer != null) {
            peer.updateSecurityWarningVisibility();
        }
    }
}
 
Example 4
Source File: CWarningWindow.java    From hottub with GNU General Public License v2.0 6 votes vote down vote up
@Override
public void notifyMouseEvent(int id, long when, int button, int x, int y,
                             int screenX, int screenY, int modifiers,
                             int clickCount, boolean popupTrigger,
                             byte[] bdata) {
    LWWindowPeer peer = ownerPeer.get();
    if (id == MouseEvent.MOUSE_EXITED) {
        if (peer != null) {
            peer.updateSecurityWarningVisibility();
        }
    } else if(id == MouseEvent.MOUSE_ENTERED) {
        if (peer != null) {
            peer.updateSecurityWarningVisibility();
        }
    }
}
 
Example 5
Source File: CPlatformResponder.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Handles mouse events.
 */
void handleMouseEvent(int eventType, int modifierFlags, int buttonNumber,
                      int clickCount, int x, int y, int absoluteX,
                      int absoluteY) {
    final SunToolkit tk = (SunToolkit)Toolkit.getDefaultToolkit();
    if ((buttonNumber > 2 && !tk.areExtraMouseButtonsEnabled())
            || buttonNumber > tk.getNumberOfButtons() - 1) {
        return;
    }

    int jeventType = isNpapiCallback ? NSEvent.npToJavaEventType(eventType) :
                                       NSEvent.nsToJavaEventType(eventType);

    int jbuttonNumber = MouseEvent.NOBUTTON;
    int jclickCount = 0;

    if (jeventType != MouseEvent.MOUSE_MOVED &&
        jeventType != MouseEvent.MOUSE_ENTERED &&
        jeventType != MouseEvent.MOUSE_EXITED)
    {
        jbuttonNumber = NSEvent.nsToJavaButton(buttonNumber);
        jclickCount = clickCount;
    }

    int jmodifiers = NSEvent.nsToJavaMouseModifiers(buttonNumber,
                                                    modifierFlags);
    boolean jpopupTrigger = NSEvent.isPopupTrigger(jmodifiers);

    eventNotifier.notifyMouseEvent(jeventType, System.currentTimeMillis(), jbuttonNumber,
            x, y, absoluteX, absoluteY, jmodifiers, jclickCount,
            jpopupTrigger, null);
}
 
Example 6
Source File: CPlatformResponder.java    From dragonwell8_jdk with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Handles mouse events.
 */
void handleMouseEvent(int eventType, int modifierFlags, int buttonNumber,
                      int clickCount, int x, int y, int absoluteX,
                      int absoluteY) {
    final SunToolkit tk = (SunToolkit)Toolkit.getDefaultToolkit();
    if ((buttonNumber > 2 && !tk.areExtraMouseButtonsEnabled())
            || buttonNumber > tk.getNumberOfButtons() - 1) {
        return;
    }

    int jeventType = isNpapiCallback ? NSEvent.npToJavaEventType(eventType) :
                                       NSEvent.nsToJavaEventType(eventType);

    int jbuttonNumber = MouseEvent.NOBUTTON;
    int jclickCount = 0;

    if (jeventType != MouseEvent.MOUSE_MOVED &&
        jeventType != MouseEvent.MOUSE_ENTERED &&
        jeventType != MouseEvent.MOUSE_EXITED)
    {
        jbuttonNumber = NSEvent.nsToJavaButton(buttonNumber);
        jclickCount = clickCount;
    }

    int jmodifiers = NSEvent.nsToJavaMouseModifiers(buttonNumber,
                                                    modifierFlags);
    boolean jpopupTrigger = NSEvent.isPopupTrigger(jmodifiers);

    eventNotifier.notifyMouseEvent(jeventType, System.currentTimeMillis(), jbuttonNumber,
            x, y, absoluteX, absoluteY, jmodifiers, jclickCount,
            jpopupTrigger, null);
}
 
Example 7
Source File: CPlatformResponder.java    From openjdk-8 with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Handles mouse events.
 */
void handleMouseEvent(int eventType, int modifierFlags, int buttonNumber,
                      int clickCount, int x, int y, int absoluteX,
                      int absoluteY) {
    final SunToolkit tk = (SunToolkit)Toolkit.getDefaultToolkit();
    if ((buttonNumber > 2 && !tk.areExtraMouseButtonsEnabled())
            || buttonNumber > tk.getNumberOfButtons() - 1) {
        return;
    }

    int jeventType = isNpapiCallback ? NSEvent.npToJavaEventType(eventType) :
                                       NSEvent.nsToJavaEventType(eventType);

    int jbuttonNumber = MouseEvent.NOBUTTON;
    int jclickCount = 0;

    if (jeventType != MouseEvent.MOUSE_MOVED &&
        jeventType != MouseEvent.MOUSE_ENTERED &&
        jeventType != MouseEvent.MOUSE_EXITED)
    {
        jbuttonNumber = NSEvent.nsToJavaButton(buttonNumber);
        jclickCount = clickCount;
    }

    int jmodifiers = NSEvent.nsToJavaMouseModifiers(buttonNumber,
                                                    modifierFlags);
    boolean jpopupTrigger = NSEvent.isPopupTrigger(jmodifiers);

    eventNotifier.notifyMouseEvent(jeventType, System.currentTimeMillis(), jbuttonNumber,
            x, y, absoluteX, absoluteY, jmodifiers, jclickCount,
            jpopupTrigger, null);
}
 
Example 8
Source File: bug7146377.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
private static String eventToString(MouseEvent e) {
    StringBuilder result = new StringBuilder();

    switch (e.getID()) {
        case MouseEvent.MOUSE_PRESSED:
            result.append("MOUSE_PRESSED");
            break;
        case MouseEvent.MOUSE_RELEASED:
            result.append("MOUSE_RELEASED");
            break;
        case MouseEvent.MOUSE_CLICKED:
            result.append("MOUSE_CLICKED");
            break;
        case MouseEvent.MOUSE_ENTERED:
            result.append("MOUSE_ENTERED");
            break;
        case MouseEvent.MOUSE_EXITED:
            result.append("MOUSE_EXITED");
            break;
        case MouseEvent.MOUSE_MOVED:
            result.append("MOUSE_MOVED");
            break;
        case MouseEvent.MOUSE_DRAGGED:
            result.append("MOUSE_DRAGGED");
            break;
        case MouseEvent.MOUSE_WHEEL:
            result.append("MOUSE_WHEEL");
            break;
        default:
            result.append("unknown type");
    }

    result.append(", modifiers = " + MouseEvent.getMouseModifiersText(e.getModifiers()));
    result.append(", modifiersEx = " + MouseEvent.getMouseModifiersText(e.getModifiersEx()));
    result.append(", button = " + e.getButton());

    return result.toString();
}
 
Example 9
Source File: CPlatformResponder.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Handles mouse events.
 */
void handleMouseEvent(int eventType, int modifierFlags, int buttonNumber,
                      int clickCount, int x, int y, int absX, int absY) {
    final SunToolkit tk = (SunToolkit)Toolkit.getDefaultToolkit();
    if ((buttonNumber > 2 && !tk.areExtraMouseButtonsEnabled())
            || buttonNumber > tk.getNumberOfButtons() - 1) {
        return;
    }

    int jeventType = isNpapiCallback ? NSEvent.npToJavaEventType(eventType) :
                                       NSEvent.nsToJavaEventType(eventType);

    int jbuttonNumber = MouseEvent.NOBUTTON;
    int jclickCount = 0;

    if (jeventType != MouseEvent.MOUSE_MOVED &&
        jeventType != MouseEvent.MOUSE_ENTERED &&
        jeventType != MouseEvent.MOUSE_EXITED)
    {
        jbuttonNumber = NSEvent.nsToJavaButton(buttonNumber);
        jclickCount = clickCount;
    }

    int jmodifiers = NSEvent.nsToJavaModifiers(modifierFlags);
    boolean jpopupTrigger = NSEvent.isPopupTrigger(jmodifiers);

    eventNotifier.notifyMouseEvent(jeventType, System.currentTimeMillis(), jbuttonNumber,
            x, y, absX, absY, jmodifiers, jclickCount,
            jpopupTrigger, null);
}
 
Example 10
Source File: ArrangementGroupingRulesControl.java    From consulo with Apache License 2.0 5 votes vote down vote up
@Override
protected void processMouseEvent(MouseEvent e) {
  if (e.getID() == MouseEvent.MOUSE_EXITED && myRowUnderMouse >= 0) {
    int row = myRowUnderMouse;
    myRowUnderMouse = -1;
    getModel().fireTableRowsUpdated(row, row);
  }
  super.processMouseEvent(e);
}
 
Example 11
Source File: XDnDDropTargetProtocol.java    From openjdk-jdk9 with GNU General Public License v2.0 4 votes vote down vote up
public boolean sendResponse(long ctxt, int eventID, int action) {
    XClientMessageEvent xclient = new XClientMessageEvent(ctxt);

    if (xclient.get_message_type() !=
        XDnDConstants.XA_XdndPosition.getAtom()) {

        return false;
    }

    if (eventID == MouseEvent.MOUSE_EXITED) {
        action = DnDConstants.ACTION_NONE;
    }

    XClientMessageEvent msg = new XClientMessageEvent();
    try {
        msg.set_type(XConstants.ClientMessage);
        msg.set_window(xclient.get_data(0));
        msg.set_format(32);
        msg.set_message_type(XDnDConstants.XA_XdndStatus.getAtom());
        /* target window */
        msg.set_data(0, xclient.get_window());
        /* flags */
        long flags = 0;
        if (action != DnDConstants.ACTION_NONE) {
            flags |= XDnDConstants.XDND_ACCEPT_DROP_FLAG;
        }
        msg.set_data(1, flags);
        /* specify an empty rectangle */
        msg.set_data(2, 0); /* x, y */
        msg.set_data(3, 0); /* w, h */
        /* action accepted by the target */
        msg.set_data(4, XDnDConstants.getXDnDActionForJavaAction(action));

        XToolkit.awtLock();
        try {
            XlibWrapper.XSendEvent(XToolkit.getDisplay(),
                                   xclient.get_data(0),
                                   false, XConstants.NoEventMask,
                                   msg.pData);
        } finally {
            XToolkit.awtUnlock();
        }
    } finally {
        msg.dispose();
    }

    return true;
}
 
Example 12
Source File: XButtonPeer.java    From jdk8u_jdk with GNU General Public License v2.0 4 votes vote down vote up
void handleJavaMouseEvent(MouseEvent e) {
    super.handleJavaMouseEvent(e);
    int id = e.getID();
    switch (id) {
      case MouseEvent.MOUSE_PRESSED:
          if (XToolkit.isLeftMouseButton(e) ) {
              Button b = (Button) e.getSource();

              if(b.contains(e.getX(), e.getY())) {
                  if (!isEnabled()) {
                      // Disabled buttons ignore all input...
                      return;
                  }
                  pressed = true;
                  armed = true;
                  repaint();
              }
          }

          break;

      case MouseEvent.MOUSE_RELEASED:
          if (XToolkit.isLeftMouseButton(e)) {
              if (armed)
              {
                  action(e.getWhen(),e.getModifiers());
              }
              pressed = false;
              armed = false;
              repaint();
          }

          break;

      case  MouseEvent.MOUSE_ENTERED:
          if (pressed)
              armed = true;
          break;
      case MouseEvent.MOUSE_EXITED:
          armed = false;
          break;
    }
}
 
Example 13
Source File: XDnDDropTargetProtocol.java    From openjdk-jdk8u with GNU General Public License v2.0 4 votes vote down vote up
public boolean sendResponse(long ctxt, int eventID, int action) {
    XClientMessageEvent xclient = new XClientMessageEvent(ctxt);

    if (xclient.get_message_type() !=
        XDnDConstants.XA_XdndPosition.getAtom()) {

        return false;
    }

    if (eventID == MouseEvent.MOUSE_EXITED) {
        action = DnDConstants.ACTION_NONE;
    }

    XClientMessageEvent msg = new XClientMessageEvent();
    try {
        msg.set_type((int)XConstants.ClientMessage);
        msg.set_window(xclient.get_data(0));
        msg.set_format(32);
        msg.set_message_type(XDnDConstants.XA_XdndStatus.getAtom());
        /* target window */
        msg.set_data(0, xclient.get_window());
        /* flags */
        long flags = 0;
        if (action != DnDConstants.ACTION_NONE) {
            flags |= XDnDConstants.XDND_ACCEPT_DROP_FLAG;
        }
        msg.set_data(1, flags);
        /* specify an empty rectangle */
        msg.set_data(2, 0); /* x, y */
        msg.set_data(3, 0); /* w, h */
        /* action accepted by the target */
        msg.set_data(4, XDnDConstants.getXDnDActionForJavaAction(action));

        XToolkit.awtLock();
        try {
            XlibWrapper.XSendEvent(XToolkit.getDisplay(),
                                   xclient.get_data(0),
                                   false, XConstants.NoEventMask,
                                   msg.pData);
        } finally {
            XToolkit.awtUnlock();
        }
    } finally {
        msg.dispose();
    }

    return true;
}
 
Example 14
Source File: XButtonPeer.java    From openjdk-8-source with GNU General Public License v2.0 4 votes vote down vote up
void handleJavaMouseEvent(MouseEvent e) {
    super.handleJavaMouseEvent(e);
    int id = e.getID();
    switch (id) {
      case MouseEvent.MOUSE_PRESSED:
          if (XToolkit.isLeftMouseButton(e) ) {
              Button b = (Button) e.getSource();

              if(b.contains(e.getX(), e.getY())) {
                  if (!isEnabled()) {
                      // Disabled buttons ignore all input...
                      return;
                  }
                  pressed = true;
                  armed = true;
                  repaint();
              }
          }

          break;

      case MouseEvent.MOUSE_RELEASED:
          if (XToolkit.isLeftMouseButton(e)) {
              if (armed)
              {
                  action(e.getWhen(),e.getModifiers());
              }
              pressed = false;
              armed = false;
              repaint();
          }

          break;

      case  MouseEvent.MOUSE_ENTERED:
          if (pressed)
              armed = true;
          break;
      case MouseEvent.MOUSE_EXITED:
          armed = false;
          break;
    }
}
 
Example 15
Source File: XDnDDropTargetProtocol.java    From openjdk-8-source with GNU General Public License v2.0 4 votes vote down vote up
public boolean sendResponse(long ctxt, int eventID, int action) {
    XClientMessageEvent xclient = new XClientMessageEvent(ctxt);

    if (xclient.get_message_type() !=
        XDnDConstants.XA_XdndPosition.getAtom()) {

        return false;
    }

    if (eventID == MouseEvent.MOUSE_EXITED) {
        action = DnDConstants.ACTION_NONE;
    }

    XClientMessageEvent msg = new XClientMessageEvent();
    try {
        msg.set_type((int)XConstants.ClientMessage);
        msg.set_window(xclient.get_data(0));
        msg.set_format(32);
        msg.set_message_type(XDnDConstants.XA_XdndStatus.getAtom());
        /* target window */
        msg.set_data(0, xclient.get_window());
        /* flags */
        long flags = 0;
        if (action != DnDConstants.ACTION_NONE) {
            flags |= XDnDConstants.XDND_ACCEPT_DROP_FLAG;
        }
        msg.set_data(1, flags);
        /* specify an empty rectangle */
        msg.set_data(2, 0); /* x, y */
        msg.set_data(3, 0); /* w, h */
        /* action accepted by the target */
        msg.set_data(4, XDnDConstants.getXDnDActionForJavaAction(action));

        XToolkit.awtLock();
        try {
            XlibWrapper.XSendEvent(XToolkit.getDisplay(),
                                   xclient.get_data(0),
                                   false, XConstants.NoEventMask,
                                   msg.pData);
        } finally {
            XToolkit.awtUnlock();
        }
    } finally {
        msg.dispose();
    }

    return true;
}
 
Example 16
Source File: JavaRecorderHook.java    From marathonv5 with Apache License 2.0 4 votes vote down vote up
private boolean isFocusChangeEvent(int id) {
    return id != MouseEvent.MOUSE_ENTERED && id != MouseEvent.MOUSE_EXITED && id != MouseEvent.MOUSE_MOVED;
}
 
Example 17
Source File: SamplerViewSupport.java    From visualvm with GNU General Public License v2.0 4 votes vote down vote up
protected void processMouseEvent(MouseEvent e) {
    if (!isSelected() || MouseEvent.MOUSE_EXITED == e.getID()) super.processMouseEvent(e);
}
 
Example 18
Source File: ThreeComponentsSplitter.java    From consulo with Apache License 2.0 4 votes vote down vote up
protected void processMouseEvent(MouseEvent e) {
  super.processMouseEvent(e);
  if (!isShowing()) {
    return;
  }
  switch (e.getID()) {
    case MouseEvent.MOUSE_ENTERED:
      setCursor(getResizeCursor());
      break;
    case MouseEvent.MOUSE_EXITED:
      if (!myDragging) {
        setCursor(Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR));
      }
      break;
    case MouseEvent.MOUSE_PRESSED:
      if (isInside(e.getPoint())) {
        myWasPressedOnMe = true;
        if (myGlassPane != null) {
          myGlassPane.setCursor(getResizeCursor(), myListener);
        }
        e.consume();
      } else {
        myWasPressedOnMe = false;
      }
      break;
    case MouseEvent.MOUSE_RELEASED:
      if (myWasPressedOnMe) {
        e.consume();
      }
      if (isInside(e.getPoint()) && myGlassPane != null) {
        myGlassPane.setCursor(getResizeCursor(), myListener);
      }
      myWasPressedOnMe = false;
      myDragging = false;
      myPoint = null;
      break;
    case MouseEvent.MOUSE_CLICKED:
      if (e.getClickCount() == 2) {
        center();
      }
      break;
  }
}
 
Example 19
Source File: ProfilerTableHover.java    From visualvm with GNU General Public License v2.0 4 votes vote down vote up
private boolean isIgnoreEvent(MouseEvent e) {
    int eventID = e.getID();
    return eventID == MouseEvent.MOUSE_ENTERED ||
           eventID == MouseEvent.MOUSE_EXITED;
}
 
Example 20
Source File: XDnDDropTargetProtocol.java    From jdk8u_jdk with GNU General Public License v2.0 4 votes vote down vote up
public boolean sendResponse(long ctxt, int eventID, int action) {
    XClientMessageEvent xclient = new XClientMessageEvent(ctxt);

    if (xclient.get_message_type() !=
        XDnDConstants.XA_XdndPosition.getAtom()) {

        return false;
    }

    if (eventID == MouseEvent.MOUSE_EXITED) {
        action = DnDConstants.ACTION_NONE;
    }

    XClientMessageEvent msg = new XClientMessageEvent();
    try {
        msg.set_type((int)XConstants.ClientMessage);
        msg.set_window(xclient.get_data(0));
        msg.set_format(32);
        msg.set_message_type(XDnDConstants.XA_XdndStatus.getAtom());
        /* target window */
        msg.set_data(0, xclient.get_window());
        /* flags */
        long flags = 0;
        if (action != DnDConstants.ACTION_NONE) {
            flags |= XDnDConstants.XDND_ACCEPT_DROP_FLAG;
        }
        msg.set_data(1, flags);
        /* specify an empty rectangle */
        msg.set_data(2, 0); /* x, y */
        msg.set_data(3, 0); /* w, h */
        /* action accepted by the target */
        msg.set_data(4, XDnDConstants.getXDnDActionForJavaAction(action));

        XToolkit.awtLock();
        try {
            XlibWrapper.XSendEvent(XToolkit.getDisplay(),
                                   xclient.get_data(0),
                                   false, XConstants.NoEventMask,
                                   msg.pData);
        } finally {
            XToolkit.awtUnlock();
        }
    } finally {
        msg.dispose();
    }

    return true;
}