java.awt.event.MouseEvent.getModifiersEx()方法的使用及代码示例

x33g5p2x  于2022-01-24 转载在 其他  
字(7.8k)|赞(0)|评价(0)|浏览(188)

本文整理了Java中java.awt.event.MouseEvent.getModifiersEx()方法的一些代码示例,展示了MouseEvent.getModifiersEx()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。MouseEvent.getModifiersEx()方法的具体详情如下:
包路径:java.awt.event.MouseEvent
类名称:MouseEvent
方法名:getModifiersEx

MouseEvent.getModifiersEx介绍

暂无

代码示例

代码示例来源:origin: runelite/runelite

private MouseEvent translateEvent(MouseEvent e)
  {
    Dimension stretchedDimensions = client.getStretchedDimensions();
    Dimension realDimensions = client.getRealDimensions();

    int newX = (int) (e.getX() / (stretchedDimensions.width / realDimensions.getWidth()));
    int newY = (int) (e.getY() / (stretchedDimensions.height / realDimensions.getHeight()));

    return new MouseEvent((Component) e.getSource(), e.getID(), e.getWhen(), e.getModifiersEx(),
        newX, newY, e.getClickCount(), e.isPopupTrigger(), e.getButton());
  }
}

代码示例来源:origin: checkstyle/checkstyle

final MouseEvent mouseEvent = (MouseEvent) event;
final MouseEvent newMouseEvent = new MouseEvent(tree, mouseEvent.getID(),
    mouseEvent.getWhen(), mouseEvent.getModifiersEx(),
    mouseEvent.getX() - getCellRect(0, counter, true).x,
    mouseEvent.getY(), mouseEvent.getClickCount(),

代码示例来源:origin: stanfordnlp/CoreNLP

@Override
public void mousePressed(MouseEvent e) {
 if (MatchesPanel.getInstance().isEmpty()) return;
 if(firstMouseEvent == null) {
  firstMouseEvent = e;
 }
 e.consume();
 TreeFromFile selectedValue = (TreeFromFile) list.getSelectedValue();
 if(selectedValue == null) return;
 JTextField label = selectedValue.getLabel();
 if(((e.getModifiersEx()) & InputEvent.SHIFT_DOWN_MASK) == InputEvent.SHIFT_DOWN_MASK) {
  //shift is being held
  addHighlight(label, firstMouseEvent, e);
 } else if(!HighlightUtils.isInHighlight(e, label, label.getHighlighter())) {
  label.getHighlighter().removeAllHighlights();
  firstMouseEvent = e;
  dragNDrop = false;
  list.repaint();
 } else {
  //in a highlight, if we drag after this, we'll be DnDing
  dragNDrop = true;
 }
}

代码示例来源:origin: stanfordnlp/CoreNLP

@Override
public void mousePressed(MouseEvent e) {
 if (MatchesPanel.getInstance().isEmpty()) return;
 if(firstMouseEvent == null) {
  firstMouseEvent = e;
 }
 e.consume();
 if(((e.getModifiersEx()) & InputEvent.SHIFT_DOWN_MASK) == InputEvent.SHIFT_DOWN_MASK) {
  //shift is being held
  addHighlight(textField, firstMouseEvent, e);
 } else if(!HighlightUtils.isInHighlight(e, textField, textField.getHighlighter())) {
  textField.getHighlighter().removeAllHighlights();
  firstMouseEvent = e;
  dragNDrop = false;
  textField.repaint();
 } else {
  //in a highlight, if we drag after this, we'll be DnDing
  dragNDrop = true;
 }
}

代码示例来源:origin: deathmarine/Luyten

@Override
public synchronized void mouseMoved(MouseEvent e) {
  String linkText = null;
  boolean isLinkLabel = false;
  boolean isCtrlDown = (e.getModifiersEx() & InputEvent.CTRL_DOWN_MASK) != 0;
  if (isCtrlDown) {
    linkText = createLinkLabel(e);
    isLinkLabel = linkText != null;
  }
  if (isCtrlDown && isWaitForLinksCursor) {
    textArea.setCursor(new Cursor(Cursor.WAIT_CURSOR));
  } else if (textArea.getCursor().getType() == Cursor.WAIT_CURSOR) {
    textArea.setCursor(new Cursor(Cursor.DEFAULT_CURSOR));
  }
  JLabel label = OpenFile.this.mainWindow.getLabel();
  if (isLinkLabel && isLinkLabelPrev) {
    if (!linkText.equals(prevLinkText)) {
      setLinkLabel(label, linkText);
    }
  } else if (isLinkLabel && !isLinkLabelPrev) {
    setLinkLabel(label, linkText);
  } else if (!isLinkLabel && isLinkLabelPrev) {
    setLinkLabel(label, null);
  }
  isLinkLabelPrev = isLinkLabel;
  prevLinkText = linkText;
}

代码示例来源:origin: apache/cloudstack

protected int getPointerFlags(MouseOrder order) {
  int flags = 0;
  int modifiers = order.event.getModifiersEx();

代码示例来源:origin: apache/cloudstack

@Override
public void mouseDragged(MouseEvent e) {
  queue.add(new MouseEventPacket(mapAwtModifiersToVncButtonMask(e.getModifiersEx()), e.getX(), e.getY()));
}

代码示例来源:origin: apache/cloudstack

@Override
public void mouseMoved(MouseEvent e) {
  queue.add(new MouseEventPacket(mapAwtModifiersToVncButtonMask(e.getModifiersEx()), e.getX(), e.getY()));
}

代码示例来源:origin: apache/cloudstack

@Override
public void mousePressed(MouseEvent e) {
  queue.add(new MouseEventPacket(mapAwtModifiersToVncButtonMask(e.getModifiersEx()), e.getX(), e.getY()));
}

代码示例来源:origin: apache/cloudstack

@Override
public void mouseReleased(MouseEvent e) {
  queue.add(new MouseEventPacket(mapAwtModifiersToVncButtonMask(e.getModifiersEx()), e.getX(), e.getY()));
}

代码示例来源:origin: nodebox/nodebox

public void mouseDragged(MouseEvent e) {
  if (!isEnabled()) return;
  if (!isDragging) return;
  double deltaX = e.getX() - previousX;
  if (deltaX == 0F) return;
  if ((e.getModifiersEx() & MouseEvent.SHIFT_DOWN_MASK) > 0) {
    deltaX *= 10;
  } else if ((e.getModifiersEx() & MouseEvent.ALT_DOWN_MASK) > 0) {
    deltaX *= 0.01;
  }
  setValue(getValue() + deltaX);
  previousX = e.getX();
  fireStateChanged();
}

代码示例来源:origin: nodebox/nodebox

public void mouseClicked(MouseEvent e) {
  if (!isEnabled()) return;
  double dx = 1.0F;
  if ((e.getModifiersEx() & MouseEvent.SHIFT_DOWN_MASK) > 0) {
    dx = 10F;
  } else if ((e.getModifiersEx() & MouseEvent.ALT_DOWN_MASK) > 0) {
    dx = 0.01F;
  }
  if (getLeftButtonRect().contains(e.getPoint())) {
    setValue(getValue() - dx);
    fireStateChanged();
  } else if (getRightButtonRect().contains(e.getPoint())) {
    setValue(getValue() + dx);
    fireStateChanged();
  } else if (e.getClickCount() >= 2) {
    showNumberField();
  }
}

代码示例来源:origin: apache/cloudstack

@Override
public void handleData(ByteBuffer buf, Link link) {
  if (verbose)
    System.out.println("[" + this + "] INFO: Data received: " + buf + ".");
  // Get mouse event
  MouseOrder order = (MouseOrder)buf.getOrder();
  ByteBuffer outBuf = new ByteBuffer(6);
  outBuf.writeByte(RfbConstants.CLIENT_POINTER_EVENT);
  int buttonMask = mapAwtModifiersToVncButtonMask(order.event.getModifiersEx());
  outBuf.writeByte(buttonMask);
  outBuf.writeShort(order.event.getX());
  outBuf.writeShort(order.event.getY());
  pushDataToAllOuts(outBuf);
}

代码示例来源:origin: bobbylight/RSyntaxTextArea

if ((e.getModifiersEx()&linkScanningMask)==linkScanningMask) {

代码示例来源:origin: freeplane/freeplane

private static int getModifiers(final MouseEvent e) {
  return e.getModifiersEx() &
      (InputEvent.CTRL_DOWN_MASK
          | InputEvent.META_DOWN_MASK
          | InputEvent.SHIFT_DOWN_MASK
          | InputEvent.ALT_DOWN_MASK
          );
}

代码示例来源:origin: stackoverflow.com

@Override
public void mouseExited(MouseEvent event) // Or any other mouse event handler...
{
  int buttonsDownMask = MouseEvent.BUTTON1_DOWN_MASK 
      | MouseEvent.BUTTON2_DOWN_MASK 
      | MouseEvent.BUTTON3_DOWN_MASK; // Or whichever buttons you care about...
  if ( (event.getModifiersEx() & buttonsDownMask) != 0 )
    System.out.println("Hey! Some button is pressed!");
}

代码示例来源:origin: JetBrains/jediterm

private static int applyModifierKeys(MouseEvent event, int cb) {
 if (event.isControlDown()) {
  cb |= MouseButtonModifierFlags.MOUSE_BUTTON_CTRL_FLAG;
 }
 if (event.isShiftDown()) {
  cb |= MouseButtonModifierFlags.MOUSE_BUTTON_SHIFT_FLAG;
 }
 if ((event.getModifiersEx() & InputEvent.META_MASK) != 0) {
  cb |= MouseButtonModifierFlags.MOUSE_BUTTON_META_FLAG;
 }
 return cb;
}

代码示例来源:origin: robo-code/robocode

public void serialize(RbSerializer serializer, ByteBuffer buffer, Object object) {
  MouseClickedEvent obj = (MouseClickedEvent) object;
  java.awt.event.MouseEvent src = obj.getSourceEvent();
  serializer.serialize(buffer, src.getButton());
  serializer.serialize(buffer, src.getClickCount());
  serializer.serialize(buffer, src.getX());
  serializer.serialize(buffer, src.getY());
  serializer.serialize(buffer, src.getID());
  serializer.serialize(buffer, src.getModifiersEx());
  serializer.serialize(buffer, src.getWhen());
}

代码示例来源:origin: robo-code/robocode

public void serialize(RbSerializer serializer, ByteBuffer buffer, Object object) {
  MousePressedEvent obj = (MousePressedEvent) object;
  java.awt.event.MouseEvent src = obj.getSourceEvent();
  serializer.serialize(buffer, src.getButton());
  serializer.serialize(buffer, src.getClickCount());
  serializer.serialize(buffer, src.getX());
  serializer.serialize(buffer, src.getY());
  serializer.serialize(buffer, src.getID());
  serializer.serialize(buffer, src.getModifiersEx());
  serializer.serialize(buffer, src.getWhen());
}

代码示例来源:origin: org.scijava/scijava-ui-awt

@Override
public void mouseExited(final MouseEvent e) {
  final InputModifiers modifiers = createModifiers(e.getModifiersEx());
  updateMouseCoords(e);
  final MsExitedEvent evt = new MsExitedEvent(display, modifiers, x, y);
  clearMouseCoords();
  eventService.publish(evt);
  if (evt.isConsumed()) e.consume();
}

相关文章