8040630: Popup menus and tooltips flicker with previous popup contents when first shown

Reviewed-by: kizune, pbansal
This commit is contained in:
Sergey Bylokhov 2020-03-10 13:58:46 -07:00
parent 40f6d697d2
commit f3ef97263f

View File

@ -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 @@ public class Popup {
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();