< prev index next >

src/java.desktop/share/classes/javax/swing/Popup.java

Print this page

        

@@ -1,7 +1,7 @@
 /*
- * Copyright (c) 1999, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 2020, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
  * under the terms of the GNU General Public License version 2 only, as
  * published by the Free Software Foundation.  Oracle designates this

@@ -23,14 +23,18 @@
  * questions.
  */
 
 package javax.swing;
 
-import java.awt.*;
+import java.awt.BorderLayout;
+import java.awt.Component;
+import java.awt.Frame;
+import java.awt.Graphics;
+import java.awt.GraphicsEnvironment;
+import java.awt.Window;
 
 import sun.awt.ModalExclude;
-import sun.awt.SunToolkit;
 
 /**
  * Popups are used to display a <code>Component</code> to the user, typically
  * on top of all the other <code>Component</code>s in a particular containment
  * hierarchy. <code>Popup</code>s have a very small life cycle. Once you

@@ -155,12 +159,12 @@
 
         Component c = getComponent();
 
         if (c instanceof JWindow) {
             JWindow component = (JWindow)getComponent();
-
-            component.setLocation(ownerX, ownerY);
+            // Sets the proper location, and resets internal state of the window
+            component.setBounds(ownerX, ownerY, 1, 1);
             component.getContentPane().add(contents, BorderLayout.CENTER);
             component.invalidate();
             component.validate();
             if(component.isVisible()) {
                 // Do not call pack() if window is not visible to
< prev index next >