return new Popup.JWindowPopup(owner, contents, x, y);
Popup popup = null;   boolean lightweightEnabled = true;   if (contents instanceof JPopupMenu) { JPopupMenu menu = (JPopupMenu) contents; lightweightEnabled = menu.isLightWeightPopupEnabled(); }    JRootPane root = SwingUtilities.getRootPane(owner); Point rootLoc = root.getLocationOnScreen(); Dimension contentsSize = contents.getSize(); Dimension rootSize = root.getSize(); if (x >= rootLoc.x && y > rootLoc.y && (x - rootLoc.x) + contentsSize.width < rootSize.width && (y - rootLoc.y) + contentsSize.height < rootSize.height) popup = new Popup.LightweightPopup(owner, contents, x, y); else popup = new Popup.JWindowPopup(owner, contents, x, y); return popup;
  public Popup getPopup(Component owner, Component contents,                        int x, int y)  {    return new Popup.JWindowPopup(owner, contents, x, y);  }