changeset 58495:2f6ba1720303

8040630: Popup menus and tooltips flicker with previous popup contents when first shown Reviewed-by: kizune, pbansal
author serb
date Tue, 10 Mar 2020 13:58:46 -0700
parents 392d5e420c73
children f0242c3b42ab
files src/java.desktop/share/classes/javax/swing/Popup.java
diffstat 1 files changed, 9 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/src/java.desktop/share/classes/javax/swing/Popup.java	Tue Mar 10 11:30:33 2020 -0700
+++ b/src/java.desktop/share/classes/javax/swing/Popup.java	Tue Mar 10 13:58:46 2020 -0700
@@ -1,5 +1,5 @@
 /*
- * 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
@@ -25,10 +25,14 @@
 
 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
@@ -157,8 +161,8 @@
 
         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();