javax.swing.JPopupMenu.getLocationOnScreen()方法的使用及代码示例

x33g5p2x  于2022-01-21 转载在 其他  
字(4.7k)|赞(0)|评价(0)|浏览(92)

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

JPopupMenu.getLocationOnScreen介绍

暂无

代码示例

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

public static boolean isPopupContained(JPopupMenu popup) {
  if (!popup.isShowing()) {
    return false;
  }
  return willPopupBeContained(popup, popup.getLocationOnScreen());
}

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

Point p = popup.getLocationOnScreen();
Dimension popupSize = popup.getPreferredSize();
Rectangle popupRect = new Rectangle(p, popupSize);

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

Point p = popup.getLocationOnScreen();
Point newPt = getPopupMenuOrigin(popup, p);

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

int minX = popup.getLocationOnScreen().x;
int maxX = popup.getLocationOnScreen().x + popup.getWidth();
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);

代码示例来源:origin: net.sf.squirrel-sql.thirdpary-non-maven/openide

public static boolean isPopupContained(JPopupMenu popup) {
  if (!popup.isShowing()) {
    return false;
  }
  return willPopupBeContained(popup, popup.getLocationOnScreen());
}

代码示例来源:origin: net.sf.squirrel-sql.thirdparty-non-maven/openide

public static boolean isPopupContained(JPopupMenu popup) {
  if (!popup.isShowing()) {
    return false;
  }
  return willPopupBeContained(popup, popup.getLocationOnScreen());
}

代码示例来源:origin: net.java.dev.laf-widget/laf-widget

@Override
  public void mouseDragged(MouseEvent e) {
    if (theStartPoint == null)
      return;
    if (!thePopupMenu.isShowing())
      return;
    Point newPoint = e.getPoint();
    SwingUtilities.convertPointToScreen(newPoint, (Component) e
        .getSource());
    Rectangle popupScreenRect = new Rectangle(thePopupMenu
        .getLocationOnScreen(), thePopupMenu.getSize());
    if (!popupScreenRect.contains(newPoint))
      return;
    int deltaX = (int) ((newPoint.x - thePrevPoint.x) / theScale);
    int deltaY = (int) ((newPoint.y - thePrevPoint.y) / theScale);
    scroll(deltaX, deltaY, false);
    thePrevPoint = newPoint;
  }
};

代码示例来源:origin: net.sf.nimrod/nimrod-laf

public void popupMenuWillBecomeInvisible( PopupMenuEvent ev) {
 if ( fondo == null ) {
  return;
 }
 Graphics g = papi.getRootPane().getGraphics();
 
 Point p = papi.getLocationOnScreen();
 Point r = papi.getRootPane().getLocationOnScreen();
 
 g.drawImage( fondo, p.x - r.x, p.y - r.y, null);
 fondo = null;
}

代码示例来源:origin: org.japura/japura-gui

popup.show(ToolTipButton.this, 0, getHeight());
Point point = popup.getLocationOnScreen();
Dimension dim = popup.getSize();
popupBounds =

代码示例来源:origin: com.jtattoo/JTattoo

public void popupMenuWillBecomeInvisible(PopupMenuEvent e) {
  if (popupMenuUI.screenImage != null) {
    JPopupMenu popup = (JPopupMenu) e.getSource();
    JRootPane root = popup.getRootPane();
    if (popup.isShowing() && root.isShowing()) {
      Point ptPopup = popup.getLocationOnScreen();
      Point ptRoot = root.getLocationOnScreen();
      Graphics g = popup.getRootPane().getGraphics();
      g.drawImage(popupMenuUI.screenImage, ptPopup.x - ptRoot.x, ptPopup.y - ptRoot.y, null);
      popupMenuUI.resetScreenImage();
    }
  }
}

代码示例来源:origin: net.sf.squirrel-sql.thirdpary-non-maven/openide

Point p = popup.getLocationOnScreen();
Dimension popupSize = popup.getPreferredSize ();
Rectangle popupRect = new Rectangle(p, popupSize);

代码示例来源:origin: net.sf.squirrel-sql.thirdparty-non-maven/openide

Point p = popup.getLocationOnScreen();
Dimension popupSize = popup.getPreferredSize ();
Rectangle popupRect = new Rectangle(p, popupSize);

代码示例来源:origin: net.sf.squirrel-sql.thirdpary-non-maven/openide

public static void dynamicChange(final JPopupMenu popup, boolean usedToBeContained) {
  if (!popup.isShowing()) {
    return;
  }
  if (isProblemConfig()) {
    callRefreshLater(popup);
    return;
  }
  refreshPopup(popup);
  
  Point p = popup.getLocationOnScreen();
  Point newPt = getPopupMenuOrigin(popup, p);
  boolean willBeContained = willPopupBeContained(popup, newPt);
  if (usedToBeContained != willBeContained) {
    popup.setVisible(false);
  }
  
  if (!newPt.equals(p)) {
    if (! NO_POPUP_PLACEMENT_HACK) {
      popup.setLocation(newPt.x, newPt.y);
    }
  }
  if (usedToBeContained != willBeContained) {
    popup.setVisible(true);
  }
}

代码示例来源:origin: net.sf.squirrel-sql.thirdparty-non-maven/openide

public static void dynamicChange(final JPopupMenu popup, boolean usedToBeContained) {
  if (!popup.isShowing()) {
    return;
  }
  if (isProblemConfig()) {
    callRefreshLater(popup);
    return;
  }
  refreshPopup(popup);
  
  Point p = popup.getLocationOnScreen();
  Point newPt = getPopupMenuOrigin(popup, p);
  boolean willBeContained = willPopupBeContained(popup, newPt);
  if (usedToBeContained != willBeContained) {
    popup.setVisible(false);
  }
  
  if (!newPt.equals(p)) {
    if (! NO_POPUP_PLACEMENT_HACK) {
      popup.setLocation(newPt.x, newPt.y);
    }
  }
  if (usedToBeContained != willBeContained) {
    popup.setVisible(true);
  }
}

相关文章

JPopupMenu类方法