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


Java MouseEvent.MOUSE_RELEASED属性代码示例

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


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

示例1: sendTreeHandleEvents

private void sendTreeHandleEvents(MouseEvent event) {
    int column = model.getTreeColumnIndex();
    int row = rowAtPoint(event.getPoint());
    
    MouseEvent mousePressed = new MouseEvent(treeRenderer,
            MouseEvent.MOUSE_PRESSED,
            event.getWhen(),
            event.getModifiers(),
            event.getX() - getCellRect(row, column, true).x,
            event.getY(),
            event.getClickCount(),
            event.isPopupTrigger());
    MouseEvent mouseReleased = new MouseEvent(treeRenderer,
            MouseEvent.MOUSE_RELEASED,
            event.getWhen(),
            event.getModifiers(),
            event.getX() - getCellRect(row, column, true).x,
            event.getY(),
            event.getClickCount(),
            event.isPopupTrigger());
    
    treeRenderer.dispatchEvent(mousePressed);
    treeRenderer.dispatchEvent(mouseReleased);
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:24,代码来源:NbiTreeTable.java

示例2: menuDragMouseDragged

public void menuDragMouseDragged(final MenuDragMouseEvent e) {
    if (menuItem.isEnabled() == false) return;

    final MenuSelectionManager manager = e.getMenuSelectionManager();
    final MenuElement path[] = e.getPath();

    // In Aqua, we always respect the menu's delay, if one is set.
    // Doesn't matter how the menu is clicked on or otherwise moused over.
    final Point p = e.getPoint();
    if (p.x >= 0 && p.x < menuItem.getWidth() && p.y >= 0 && p.y < menuItem.getHeight()) {
        final JMenu menu = (JMenu)menuItem;
        final MenuElement selectedPath[] = manager.getSelectedPath();
        if (!(selectedPath.length > 0 && selectedPath[selectedPath.length - 1] == menu.getPopupMenu())) {
            if (menu.getDelay() == 0) {
                appendPath(path, menu.getPopupMenu());
            } else {
                manager.setSelectedPath(path);
                setupPostTimer(menu);
            }
        }
    } else if (e.getID() == MouseEvent.MOUSE_RELEASED) {
        final Component comp = manager.componentForPoint(e.getComponent(), e.getPoint());
        if (comp == null) manager.clearSelectedPath();
    }
}
 
开发者ID:lambdalab-mirror,项目名称:jdk8u-jdk,代码行数:25,代码来源:AquaMenuUI.java

示例3: 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:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:16,代码来源:XToolkit.java

示例4: drop

public void drop(DropTargetDropEvent dtde) {
  if (dtde.getDropTargetContext().getComponent() == theMap) {
    final MouseEvent evt = new MouseEvent(
      theMap,
      MouseEvent.MOUSE_RELEASED,
      System.currentTimeMillis(),
      0,
      dtde.getLocation().x,
      dtde.getLocation().y,
      1,
      false
    );
    theMap.dispatchEvent(evt);
    dtde.dropComplete(true);
  }

  if (scroller.isRunning()) scroller.stop();
}
 
开发者ID:ajmath,项目名称:VASSAL-src,代码行数:18,代码来源:Map.java

示例5: 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

示例6: eventDispatched

/**
 * Catches all UI events from the main IDEA AWT making it possible to inspect all mouse-clicks.
 * Note that on OSX this will not catch clicks on the (detached) menu bar.
 *
 * @param e event that is caught
 */
@Override
public void eventDispatched(AWTEvent e) {
    if (e.getID() == MouseEvent.MOUSE_RELEASED && ((MouseEvent) e).getButton() == MouseEvent.BUTTON1) {
        handleMouseEvent(e);
    }
}
 
开发者ID:halirutan,项目名称:IntelliJ-Key-Promoter-X,代码行数:12,代码来源:KeyPromoter.java

示例7: 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

示例8: getCommandAtPoint

public String getCommandAtPoint(Point p, int tabState, Rectangle bounds, int mouseButton, int eventType, int modifiers) {
String result = null;
if (mouseButton == MouseEvent.BUTTON2 && eventType == MouseEvent.MOUSE_RELEASED) {
	result = TabDisplayer.COMMAND_CLOSE;
}
else {
	result = getCommandAtPoint (p, tabState, bounds);
}
      if (result != null) {
           if (TabDisplayer.COMMAND_SELECT == result) {
               boolean clipped = isClipLeft() || isClipRight();
               if ((clipped && eventType == MouseEvent.MOUSE_RELEASED && mouseButton == MouseEvent.BUTTON1) ||
                   (!clipped && eventType == MouseEvent.MOUSE_PRESSED && mouseButton == MouseEvent.BUTTON1)) {
                   
                   return result;
               }
           } else if (TabDisplayer.COMMAND_CLOSE == result && eventType == MouseEvent.MOUSE_RELEASED && isShowCloseButton()) {
               if ((modifiers & MouseEvent.SHIFT_DOWN_MASK) != 0) {
                   return TabDisplayer.COMMAND_CLOSE_ALL;
               } else if ((modifiers & MouseEvent.ALT_DOWN_MASK) != 0 && mouseButton != MouseEvent.BUTTON2) {
                   return TabDisplayer.COMMAND_CLOSE_ALL_BUT_THIS;
               } else if( ((tabState & TabState.CLOSE_BUTTON_ARMED) == 0 || (tabState & TabState.MOUSE_PRESSED_IN_CLOSE_BUTTON) == 0)
                       && mouseButton == MouseEvent.BUTTON1 )  {
                   //#208732
                   result = TabDisplayer.COMMAND_SELECT;
               }
               return result;
           }
      }
      return null;
  }
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:31,代码来源:AbstractTabCellRenderer.java

示例9: 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

示例10: eventDispatched

public void eventDispatched(AWTEvent event) {
    if (event.getID() == MouseEvent.MOUSE_PRESSED) {
        isPressed = true;
        // System.out.println("[INFO] MouseStates isPressed: " + true);
    } else if (event.getID() == MouseEvent.MOUSE_RELEASED) {
        isPressed = false;
        // System.out.println("[INFO] MouseStates isPressed: " + false);
    }
}
 
开发者ID:dmitrykolesnikovich,项目名称:featurea,代码行数:9,代码来源:MouseStates.java

示例11: 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

示例12: processMouseEvent

@Override
protected void processMouseEvent(MouseEvent evt) {
    if (evt.getID() == MouseEvent.MOUSE_RELEASED && contains(evt.getPoint())) {
        doClick();
        setArmed(true);
        return;
    }
    super.processMouseEvent(evt);
}
 
开发者ID:JFrogDev,项目名称:jfrog-idea-plugin,代码行数:9,代码来源:MenuCheckbox.java

示例13: 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:lambdalab-mirror,项目名称:jdk8u-jdk,代码行数:43,代码来源:XButtonPeer.java

示例14: processMouseEvent

/** Forwards mouse events to a renderer (tree).
 */
private void processMouseEvent(MouseEvent e) {
    if (shouldIgnore(e)) {
        return;
    }

    Point p = e.getPoint();
    int row = table.rowAtPoint(p);
    int column = table.columnAtPoint(p);

    // The autoscroller can generate drag events outside the Table's range. 
    if ((column == -1) || (row == -1)) {
        return;
    }

    // for automatic jemmy testing purposes
    if ((getEditingColumn() == column) && (getEditingRow() == row)) {
        return;
    }

    boolean changeSelection = true;

    if (isTreeColumn(column)) {
        TreePath path = tree.getPathForRow(TreeTable.this.rowAtPoint(e.getPoint()));
        Rectangle r = tree.getPathBounds(path);
 
        if ((e.getX() >= (r.x - positionX)) && (e.getX() <= (r.x - positionX + r.width))
            || isLocationInExpandControl( path, p )
            || e.getID() == MouseEvent.MOUSE_RELEASED || e.getID() == MouseEvent.MOUSE_CLICKED ) {
            changeSelection = false;
        }
    }

    if (table.getSelectionModel().isSelectedIndex(row) && e.isPopupTrigger()) {
        return;
    }

    if (table.editCellAt(row, column, e)) {
        setDispatchComponent(e);
        repostEvent(e);
    }

    if (e.getID() == MouseEvent.MOUSE_PRESSED) {
        table.requestFocus();
    }

    CellEditor editor = table.getCellEditor();

    if (changeSelection && ((editor == null) || editor.shouldSelectCell(e))) {
        setValueIsAdjusting(true);
        table.changeSelection(row, column, 
                Utilities.isMac() ? e.isMetaDown() : e.isControlDown(), //use META key on Mac to toggle selection
                e.isShiftDown());
        setValueIsAdjusting(false);
    }
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:57,代码来源:TreeTable.java

示例15: isForwardEvent

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


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