Example usage for java.awt.event MouseEvent MOUSE_EXITED

List of usage examples for java.awt.event MouseEvent MOUSE_EXITED

Introduction

In this page you can find the example usage for java.awt.event MouseEvent MOUSE_EXITED.

Prototype

int MOUSE_EXITED

To view the source code for java.awt.event MouseEvent MOUSE_EXITED.

Click Source Link

Document

The "mouse exited" event.

Usage

From source file:Main.java

/**
 * Display mouse events that don't involve mouse motion. The mousemods()
 * method prints modifiers, and is defined below. The other methods return
 * additional information about the mouse event. showLine() displays a line
 * of text in the window. It is defined at the end of this class, along with
 * the paintComponent() method.//from   w w  w . j  ava 2 s.  co m
 */
public void processMouseEvent(MouseEvent e) {
    String type = null;
    switch (e.getID()) {
    case MouseEvent.MOUSE_DRAGGED:
        type = "MOUSE_DRAGGED";
        break;
    case MouseEvent.MOUSE_RELEASED:
        type = "MOUSE_RELEASED";
        break;
    case MouseEvent.MOUSE_CLICKED:
        type = "MOUSE_CLICKED";
        break;
    case MouseEvent.MOUSE_ENTERED:
        type = "MOUSE_ENTERED";
        break;
    case MouseEvent.MOUSE_EXITED:
        type = "MOUSE_EXITED";
        break;
    }
    showLine(mousemods(e) + type + ": [" + e.getX() + "," + e.getY() + "] " + "num clicks = "
            + e.getClickCount() + (e.isPopupTrigger() ? "; is popup trigger" : ""));

    // When the mouse enters the component, request keyboard focus so
    // we can receive and respond to keyboard events
    if (e.getID() == MouseEvent.MOUSE_ENTERED)
        requestFocus();
}

From source file:EventTestPane.java

/**
 * Display mouse events that don't involve mouse motion. The mousemods()
 * method prints modifiers, and is defined below. The other methods return
 * additional information about the mouse event. showLine() displays a line
 * of text in the window. It is defined at the end of this class, along with
 * the paintComponent() method./*w  ww .j a v a 2  s.c  om*/
 */
public void processMouseEvent(MouseEvent e) {
    String type = null;
    switch (e.getID()) {
    case MouseEvent.MOUSE_PRESSED:
        type = "MOUSE_PRESSED";
        break;
    case MouseEvent.MOUSE_RELEASED:
        type = "MOUSE_RELEASED";
        break;
    case MouseEvent.MOUSE_CLICKED:
        type = "MOUSE_CLICKED";
        break;
    case MouseEvent.MOUSE_ENTERED:
        type = "MOUSE_ENTERED";
        break;
    case MouseEvent.MOUSE_EXITED:
        type = "MOUSE_EXITED";
        break;
    }
    showLine(mousemods(e) + type + ": [" + e.getX() + "," + e.getY() + "] " + "num clicks = "
            + e.getClickCount() + (e.isPopupTrigger() ? "; is popup trigger" : ""));

    // When the mouse enters the component, request keyboard focus so
    // we can receive and respond to keyboard events
    if (e.getID() == MouseEvent.MOUSE_ENTERED)
        requestFocus();
}

From source file:Diva.java

@Override
protected void processMouseEvent(MouseEvent e, JLayer l) {
    if (e.getID() == MouseEvent.MOUSE_ENTERED)
        mActive = true;/*from   ww  w.  ja va2  s. c o  m*/
    if (e.getID() == MouseEvent.MOUSE_EXITED)
        mActive = false;
    l.repaint();
}

From source file:AppletMenuBarDemo.java

/** Called when a mouse event happens over the menubar */
protected void processMouseEvent(MouseEvent e) {
    int type = e.getID(); // What type of event?
    int item = findItemAt(e.getX()); // Over which menu label?

    if (type == MouseEvent.MOUSE_PRESSED) {
        // If it was a mouse down event, then pop up the menu
        if (item == -1)
            return;
        Dimension size = getSize();
        PopupMenu pm = (PopupMenu) menus.elementAt(item);
        if (pm != null)
            pm.show(this, startPositions[item] - 3, size.height);

    } else if (type == MouseEvent.MOUSE_EXITED) {
        // If the mouse left the menubar, then unhighlight
        if (highlightedItem != -1) {
            highlightedItem = -1;/*from ww  w.  j  a v a2s .c o  m*/
            if (highlightColor != null)
                repaint();
        }
    } else if ((type == MouseEvent.MOUSE_MOVED) || (type == MouseEvent.MOUSE_ENTERED)) {
        // If the mouse moved, change the highlighted item, if necessary
        if (item != highlightedItem) {
            highlightedItem = item;
            if (highlightColor != null)
                repaint();
        }
    }
}

From source file:MouseNavigateTest.java

/**
 * @return true if this is the event that stops drag tracking behviour the
 *         default uses MOUSE_RELEASED.//  www  .j  a  v  a  2s  . c  o m
 */
//*****************************************************************************
protected boolean isStopBehaviorEvent(java.awt.event.MouseEvent evt) {
    int nId = evt.getID();
    return (m_bDragging != false && nId == MouseEvent.MOUSE_RELEASED || nId == MouseEvent.MOUSE_EXITED);
}

From source file:net.sourceforge.squirrel_sql.fw.gui.debug.DebugEventListener.java

public void eventDispatched(AWTEvent event) {
    Object o = event.getSource();
    if (o instanceof JComponent && o != null) {
        JComponent source = (JComponent) o;
        switch (event.getID()) {
        case MouseEvent.MOUSE_DRAGGED:
            printDebugInfo(source, event);
            break;
        case MouseEvent.MOUSE_ENTERED:
            printDebugInfo(source, event);
            setToolTipText(source, event);
            setBorder(source, event);/*from   w  w  w  . j av a  2 s. co  m*/
            break;
        case MouseEvent.MOUSE_EXITED:
            printDebugInfo(source, event);
            setBorder(source, event);
            break;
        }
    }
}

From source file:net.sourceforge.squirrel_sql.fw.gui.debug.DebugEventListener.java

private void setBorder(JComponent source, AWTEvent event) {
    Border border = source.getBorder();
    switch (event.getID()) {
    case MouseEvent.MOUSE_ENTERED:
        if (border != null) {
            source.setBorder(new DebugBorder(border));
        }//from  w w w . ja va  2  s  . co  m
        break;
    case MouseEvent.MOUSE_EXITED:
        if (border != null && border instanceof DebugBorder) {
            source.setBorder(((DebugBorder) border).getDelegate());
        }
        break;
    }
}

From source file:net.sourceforge.squirrel_sql.fw.gui.debug.DebugEventListener.java

private String getEventMessagePrefix(AWTEvent event) {
    String result = null;/*from   w ww  .j  a v a 2  s  . c o  m*/
    switch (event.getID()) {
    case MouseEvent.MOUSE_DRAGGED:
        result = "Mouse dragged: ";
        break;
    case MouseEvent.MOUSE_ENTERED:
        result = "Mouse entered: ";
        break;
    case MouseEvent.MOUSE_EXITED:
        result = "Mouse exited: ";
        break;
    default:
        result = "Unknown EventType: ";
    }
    return result;
}