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

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

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

MouseEvent.getYOnScreen介绍

暂无

代码示例

代码示例来源:origin: hsz/idea-gitignore

@Override
public void mousePressed(MouseEvent e) {
  if (e.getPoint().getY() <= DRAG_OFFSET) {
    dragPanelHeight = tabbedPanel.getComponent().getHeight();
    dragYOnScreen = e.getYOnScreen();
    drag = true;
  }
}

代码示例来源:origin: hsz/idea-gitignore

@Override
public void mouseDragged(MouseEvent e) {
  if (drag) {
    int height = dragPanelHeight - e.getYOnScreen() + dragYOnScreen;
    if (height > MAX_HEIGHT) {
      height = MAX_HEIGHT;
    }
    tabbedPanel.getComponent().setPreferredSize(new Dimension(0, height));
    panel.revalidate();
  }
}

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

public void mouseDragged(MouseEvent event) {
  int x = event.getXOnScreen();
  int y = event.getYOnScreen();
  this.setBounds(x - xClicked, y - yClicked, width, height);
}

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

public void mousePressed(MouseEvent e) {
 screenX = e.getXOnScreen();
 screenY = e.getYOnScreen();
public void mouseDragged(MouseEvent e) {
 int deltaX = e.getXOnScreen() - screenX;
 int deltaY = e.getYOnScreen() - screenY;

代码示例来源:origin: ron190/jsql-injection

@Override
  public void mouseReleased(MouseEvent evt) {
    if (evt.isPopupTrigger()) {
      // Fix #45348: IllegalComponentStateException on show()
      try {
        menu.show(evt.getComponent(), evt.getX(), evt.getY());
      } catch (IllegalComponentStateException e) {
        LOGGER.error(e, e);
      }
      
      menu.setLocation(
        ComponentOrientation.getOrientation(I18n.getLocaleDefault()) == ComponentOrientation.RIGHT_TO_LEFT
        ? evt.getXOnScreen() - menu.getWidth()
        : evt.getXOnScreen(),
        evt.getYOnScreen()
      );
    }
  }
});

代码示例来源:origin: ron190/jsql-injection

@Override
public void mouseClicked(MouseEvent e) {
  if (SwingUtilities.isRightMouseButton(e)) {
    Component componentSource = (Component) e.getSource();
    JPopupMenu menu = new JPopupMenu();
    for (int position = 0 ; position < MediatorGui.menubar().getMenuView().getMenuComponentCount() ; position++) {
      // Fix #35348: SerializationException on clone()
      try {
        JMenuItem itemMenu = (JMenuItem) SerializationUtils.clone(MediatorGui.menubar().getMenuView().getMenuComponent(position));
        menu.add(itemMenu);
        
        final int positionFinal = position;
        itemMenu.addActionListener(actionEvent -> MediatorGui.tabManagers().setSelectedIndex(positionFinal));
      } catch (SerializationException ex) {
        LOGGER.error(ex, ex);
      }
    }
    menu.show(componentSource, e.getX(), e.getY());
    
    menu.setLocation(
      ComponentOrientation.getOrientation(I18n.getLocaleDefault()) == ComponentOrientation.RIGHT_TO_LEFT
      ? e.getXOnScreen() - menu.getWidth()
      : e.getXOnScreen(),
      e.getYOnScreen()
    );
  }
}

代码示例来源:origin: org.netbeans.api/org-openide-awt

int minY = popup.getLocationOnScreen().y;
int maxY = popup.getLocationOnScreen().y + popup.getHeight();
if (e.getXOnScreen() < minX || e.getXOnScreen() >= maxX || e.getYOnScreen() < minY || e.getYOnScreen() >= maxY) {
  popup.setVisible(false);
int maxY = getOrientation() == HORIZONTAL ? minY + overflowButton.getHeight() + popup.getHeight()
    : minY + popup.getHeight();
if (e.getXOnScreen() < minX || e.getYOnScreen() < minY || e.getXOnScreen() > maxX || e.getYOnScreen() > maxY
    || (getOrientation() == HORIZONTAL && e.getXOnScreen() > maxX_ob
        && e.getYOnScreen() >= minY && e.getYOnScreen() < maxY_ob)
    || (getOrientation() == VERTICAL && e.getXOnScreen() >= minX && e.getXOnScreen() < maxX_ob
        && e.getYOnScreen() > maxY_ob)) {
  popup.setVisible(false);

代码示例来源:origin: ron190/jsql-injection

? mouseEvent.getXOnScreen() - popupMenuList.getWidth()
  : mouseEvent.getXOnScreen(),
  mouseEvent.getYOnScreen()
);

代码示例来源:origin: ron190/jsql-injection

? e.getXOnScreen() - popupMenu.getWidth()
  : e.getXOnScreen(),
  e.getYOnScreen()
);

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

private void showToolTip(MouseEvent e) {
  toolTip.setTipText(...);
  int x = e.getXOnScreen();
  int y = e.getYOnScreen();
  popup = popupFactory.getPopup(jEditorPane, toolTip, x, y);
  popup.show();
}

private void hideToolTip() {
  if (popup != null)
    popup.hide();
}

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

void updateFrameCoords(MouseEvent e) {
  int dx = e.getXOnScreen() - initialPressedX;
  int dy = e.getYOnScreen() - initialPressedY;
  for (int i = 0; i < OCTAGON_COORDS_X.length; i++) {
    OCTAGON_COORDS_X[i] += dx;
    OCTAGON_COORDS_Y[i] += dy;
  }
  updateFrame();
  initialPressedX = e.getXOnScreen();
  initialPressedY = e.getYOnScreen();
}

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

if (e.getButton() == MouseEvent.BUTTON1) {
  frame.add(popup);
  popup.show(frame, e.getXOnScreen(), e.getYOnScreen());

代码示例来源:origin: hneemann/Digital

@Override
  public void mouseClicked(MouseEvent event) {
    if (event.getClickCount() == 1 && event.getButton() == 3) {
      columnIndex = header.columnAtPoint(event.getPoint());
      if (columnIndex != -1)
        editColumnName(columnIndex, new Point(event.getXOnScreen(), event.getYOnScreen()));
    }
  }
});

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

public void mouseReleased(MouseEvent event)
{
  int x = event.getXOnScreen();
  int y = event.getYOnScreen();

  if(isPressed)
  {
    RectangleComponent rc = new RectangleComponent(x, y);
    frame.add(rc);
    frame.revalidate();
    frame.repaint();
  }
}

代码示例来源:origin: net.sourceforge.plantuml/plantuml

public void mouseDragged(MouseEvent event) {
  int x = event.getXOnScreen();
  int y = event.getYOnScreen();
  this.setBounds(x - xClicked, y - yClicked, width, height);
}

代码示例来源:origin: Audiveris/audiveris

@Override
public void mousePressed (MouseEvent e)
{
  glassPane.setVisible(true);
  ScreenPoint screenPoint = new ScreenPoint(e.getXOnScreen(), e.getYOnScreen());
  glassPane.setImage(image);
  glassPane.setPoint(screenPoint);
}

代码示例来源:origin: com.eas.platypus/platypus-js-forms

protected MouseWheelEvent sendWheelTo(MouseWheelEvent e, Component aComp) {
  MouseEvent me = SwingUtilities.convertMouseEvent((Component) e.getSource(), e, aComp);
  e = new MouseWheelEvent(aComp, e.getID(), e.getWhen(), e.getModifiers(), me.getX(), me.getY(), me.getXOnScreen(), me.getYOnScreen(), e.getClickCount(), e.isPopupTrigger(), e.getScrollType(), e.getScrollAmount(), e.getWheelRotation());
  for (MouseWheelListener l : aComp.getMouseWheelListeners()) {
    l.mouseWheelMoved(e);
  }
  return e;
}

代码示例来源:origin: Audiveris/audiveris

@Override
public void mouseReleased (MouseEvent e)
{
  ScreenPoint screenPoint = new ScreenPoint(e.getXOnScreen(), e.getYOnScreen());
  glassPane.setVisible(false);
  glassPane.setImage(null);
  fireDropEvent(new GhostDropEvent<>(action, screenPoint));
}

代码示例来源:origin: senbox-org/snap-desktop

private void showPopup(MouseEvent evt, JComponent component) {
  hidePopup();
  popup = new JidePopup();
  popup.setOwner(this);
  popup.setDefaultFocusComponent(component);
  popup.getContentPane().add(component);
  popup.setAttachable(true);
  popup.setMovable(false);
  popup.showPopup(evt.getXOnScreen(), evt.getYOnScreen());
}

代码示例来源:origin: bcdev/beam

private void showPopup(MouseEvent evt, JComponent component) {
  hidePopup();
  popup = new JidePopup();
  popup.setOwner(this);
  popup.setDefaultFocusComponent(component);
  popup.getContentPane().add(component);
  popup.setAttachable(true);
  popup.setMovable(false);
  popup.showPopup(evt.getXOnScreen(), evt.getYOnScreen());
}

相关文章