当前位置: 首页>>代码示例>>Java>>正文


Java MouseEvent.MOUSE_ENTERED属性代码示例

本文整理汇总了Java中java.awt.event.MouseEvent.MOUSE_ENTERED属性的典型用法代码示例。如果您正苦于以下问题:Java MouseEvent.MOUSE_ENTERED属性的具体用法?Java MouseEvent.MOUSE_ENTERED怎么用?Java MouseEvent.MOUSE_ENTERED使用的例子?那么恭喜您, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在java.awt.event.MouseEvent的用法示例。


在下文中一共展示了MouseEvent.MOUSE_ENTERED属性的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: enteredGeneratesSameEvents

public void enteredGeneratesSameEvents() throws Throwable {
    events = MouseEvent.MOUSE_ENTERED;
    SwingUtilities.invokeAndWait(new Runnable() {
        @Override public void run() {
            actionsArea.setText("");
        }
    });
    driver = new JavaDriver();
    WebElement b = driver.findElement(By.name("click-me"));
    WebElement t = driver.findElement(By.name("actions"));

    Point location = EventQueueWait.call_noexc(button, "getLocationOnScreen");
    Dimension size = EventQueueWait.call_noexc(button, "getSize");
    Robot r = new Robot();
    r.setAutoDelay(10);
    r.setAutoWaitForIdle(true);
    r.keyPress(KeyEvent.VK_ALT);
    r.mouseMove(location.x + size.width / 2, location.y + size.height / 2);
    r.mousePress(InputEvent.BUTTON1_MASK);
    r.mouseRelease(InputEvent.BUTTON1_MASK);
    r.keyRelease(KeyEvent.VK_ALT);
    new EventQueueWait() {
        @Override public boolean till() {
            return actionsArea.getText().length() > 0;
        }
    }.wait("Waiting for actionsArea failed?");
    String expected = t.getText();
    tclear();
    Point location2 = EventQueueWait.call_noexc(actionsArea, "getLocationOnScreen");
    Dimension size2 = EventQueueWait.call_noexc(actionsArea, "getSize");
    r.mouseMove(location2.x + size2.width / 2, location2.y + size2.height / 2);
    r.mousePress(InputEvent.BUTTON1_MASK);
    r.mouseRelease(InputEvent.BUTTON1_MASK);

    new Actions(driver).moveToElement(t).keyDown(Keys.ALT).moveToElement(b).click().keyUp(Keys.ALT).perform();
    AssertJUnit.assertEquals(expected, t.getText());

}
 
开发者ID:jalian-systems,项目名称:marathonv5,代码行数:38,代码来源:NativeEventsTest.java

示例2: isRightMouseButton

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;
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:16,代码来源:XToolkit.java

示例3: notifyMouseEvent

@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();
        }
    }
}
 
开发者ID:lambdalab-mirror,项目名称:jdk8u-jdk,代码行数:16,代码来源:CWarningWindow.java

示例4: notifyMouseEvent

@Override
public void notifyMouseEvent(int id, long when, int button, int x, int y,
                             int absX, int absY, 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();
        }
    }
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:16,代码来源:CWarningWindow.java

示例5: processMouseEvent

@Override
protected void processMouseEvent(MouseEvent e) {
	if (isEditable()) {
		if (e.getID() == MouseEvent.MOUSE_ENTERED)
			this.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR));
		else if (e.getID() == MouseEvent.MOUSE_CLICKED
				&& e.getX() > this.getWidth() - 20 - getInsets().top) {
			this.setText("");
			return;
		}
	}
	super.processMouseEvent(e);
}
 
开发者ID:KeepTheBeats,项目名称:alevin-svn2,代码行数:13,代码来源:AbstractSearchField.java

示例6: processMouseEvent

@Override
protected void processMouseEvent(MouseEvent e) {
    switch(e.getID()) {
      case MouseEvent.MOUSE_PRESSED:
          selectionDisabled = false;
          break;
      case MouseEvent.MOUSE_RELEASED:
          selectionDisabled = false;
          break;
      case MouseEvent.MOUSE_CLICKED:
          selectionDisabled = false;
          break;
      case MouseEvent.MOUSE_ENTERED:
          selectionDisabled = false;
          break;
      case MouseEvent.MOUSE_EXITED:
          selectionDisabled = false;
          break;
      case MouseEvent.MOUSE_MOVED:
          break;
      case MouseEvent.MOUSE_DRAGGED:
          if (selectionDisabled) {
              //System.err.println("\nDrag DISABLED.");
              return ;
          }
          break;
      case MouseEvent.MOUSE_WHEEL:
          break;
    }
    super.processMouseEvent(e);
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:31,代码来源:Outline.java

示例7: handleMouseEvent

/**
 * 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);
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:32,代码来源:CPlatformResponder.java

示例8: processEvent

public void processEvent(AWTEvent event) {
    setIndexOfType(super.getIndexOfType());
    if (event instanceof MouseEvent) {
        MouseEvent me = (MouseEvent) event;

        switch (me.getID()) {
        case MouseEvent.MOUSE_ENTERED:
            mouseEntered(me);
            break;
        case MouseEvent.MOUSE_PRESSED:
            mousePressed(me);
            break;
        case MouseEvent.MOUSE_RELEASED:
            mouseReleased(me);
            break;
        case MouseEvent.MOUSE_CLICKED:
            mouseClicked(me);
            break;
        case MouseEvent.MOUSE_EXITED:
            mouseExited(me);
            break;
        }
    } else if (event instanceof KeyEvent) {
        KeyEvent ke = (KeyEvent) event;
        switch (ke.getID()) {
        case KeyEvent.KEY_PRESSED:
            keyPressed(ke);
            break;
        case KeyEvent.KEY_RELEASED:
            keyReleased(ke);
            break;
        case KeyEvent.KEY_TYPED:
            keyTyped(ke);
            break;
        }
    }
}
 
开发者ID:jalian-systems,项目名称:marathonv5,代码行数:37,代码来源:RComponent.java

示例9: eventToString

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();
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:38,代码来源:bug7146377.java

示例10: handleMouseEvent

/**
 * 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);
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:34,代码来源:CPlatformResponder.java

示例11: eventDispatched

@Override
public void eventDispatched(AWTEvent event) {
    if (event instanceof MouseEvent) {
        MouseEvent e = (MouseEvent) event;
        if (e.getID() == MouseEvent.MOUSE_ENTERED) {
            mouseComponent = e.getComponent();
        } else if (e.getID() == MouseEvent.MOUSE_EXITED) {
            mouseComponent = null;
        }
    }
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:11,代码来源:EventDispatcher.java

示例12: isLeftMouseButton

static boolean isLeftMouseButton(MouseEvent me) {
    switch (me.getID()) {
      case MouseEvent.MOUSE_PRESSED:
      case MouseEvent.MOUSE_RELEASED:
          return (me.getButton() == MouseEvent.BUTTON1);
      case MouseEvent.MOUSE_ENTERED:
      case MouseEvent.MOUSE_EXITED:
      case MouseEvent.MOUSE_CLICKED:
      case MouseEvent.MOUSE_DRAGGED:
          return ((me.getModifiersEx() & InputEvent.BUTTON1_DOWN_MASK) != 0);
    }
    return false;
}
 
开发者ID:lambdalab-mirror,项目名称:jdk8u-jdk,代码行数:13,代码来源:XToolkit.java

示例13: isIgnoreEvent

private boolean isIgnoreEvent(MouseEvent e) {
    int eventID = e.getID();
    return eventID == MouseEvent.MOUSE_ENTERED ||
           eventID == MouseEvent.MOUSE_EXITED;
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:5,代码来源:ProfilerTableHover.java

示例14: handleJavaMouseEvent

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)
              {
                  @SuppressWarnings("deprecation")
                  final int modifiers = e.getModifiers();
                  action(e.getWhen(), modifiers);
              }
              pressed = false;
              armed = false;
              repaint();
          }

          break;

      case  MouseEvent.MOUSE_ENTERED:
          if (pressed)
              armed = true;
          break;
      case MouseEvent.MOUSE_EXITED:
          armed = false;
          break;
    }
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:45,代码来源:XButtonPeer.java

示例15: handleJavaMouseEvent

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;
    }
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:43,代码来源:XButtonPeer.java


注:本文中的java.awt.event.MouseEvent.MOUSE_ENTERED属性示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。