Skip to content
Permalink
Browse files
8040630: Popup menus and tooltips flicker with previous popup content…
…s when first shown

Reviewed-by: kizune, pbansal
  • Loading branch information
mrserb committed Mar 10, 2020
1 parent 40f6d69 commit f3ef97263fe7d99696aa3fe1845e6f19eafe3f45
Showing with 9 additions and 5 deletions.
  1. +9 −5 src/java.desktop/share/classes/javax/swing/Popup.java
@@ -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 @@ void reset(Component owner, Component contents, int ownerX, int ownerY) {

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();

0 comments on commit f3ef972

Please sign in to comment.