Details
-
Bug
-
Resolution: Fixed
-
P3
-
6u31, 7u3
Backports
Issue | Fix Version | Assignee | Priority | Status | Resolution | Resolved In Build |
---|---|---|---|---|---|---|
JDK-8043885 | 7u80 | Anton Litvinov | P3 | Resolved | Fixed | b01 |
JDK-8061023 | 7u79 | Anton Litvinov | P3 | Resolved | Fixed | b01 |
JDK-8057493 | 7u76 | Anton Litvinov | P3 | Closed | Fixed | b01 |
Description
FULL PRODUCT VERSION :
java version "1.7.0_03"
Java(TM) SE Runtime Environment (build 1.7.0_03-b05)
Java HotSpot(TM) 64-Bit Server VM (build 22.1-b02, mixed mode)
ADDITIONAL OS VERSION INFORMATION :
Windows 7 64bit
A DESCRIPTION OF THE PROBLEM :
Using the new non-opaque windows feature -
Popups (JPopupMenu/JComboBox) are initially not painted correctly if the invoking/parent Window is non-opaque using AWTUtilities#setWindowOpaque(window, false) or Window#setBackground(new Color(0, 0, 0, 0)).
This problem appears on JDK-6(1.6.0_31 x86/amd64) and JDK-7(1.7.0_3 x86/amd64).
note:
On JDK-6(1.6.0_31 x86/amd64) the initial paiting is correct but after moving the mouse one or more times over the popup, parts of the popup arenÄ'T painted any more, e.g. the border.
REGRESSION. Last worked in version 7
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
Using the new non-opaque windows feature -
Popup-Menus are initially not painted correctly if the invoking/parent Window is non-opaque using AWTUtilities#setWindowOpaque(window, false) or Window#setBackground(new Color(0, 0, 0, 0)).
This problem appears on JDK-6(1.6.0_31 x86/amd64) and JDK-7(1.7.0_3 x86/amd64).
note:
On JDK-6(1.6.0_31 x86/amd64) the initial paiting is correct but after moving the mouse one or more times over the popup, parts of the popup arenÄ'T painted any more, e.g. the border.
EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
correct painted popups.
REPRODUCIBILITY :
This bug can be reproduced always.
---------- BEGIN SOURCE ----------
package de.espirit.firstspirit.client.gui.util;
import javax.swing.AbstractAction;
import javax.swing.BorderFactory;
import javax.swing.JComboBox;
import javax.swing.JLabel;
import javax.swing.JMenuItem;
import javax.swing.JPanel;
import javax.swing.JPopupMenu;
import javax.swing.JWindow;
import javax.swing.SwingUtilities;
import java.awt.BorderLayout;
import java.awt.Color;
import java.awt.event.ActionEvent;
import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent;
/**
* $Date$
*
* @version $Revision$
*/
public class TestAwtUtilities {
public static void main(final String[] args) {
// Using non-opaque windows -
// Popup-Menus are initially not painted correctly
// if the invoking/parent Window is non-opaque using AWTUtilities#setWindowOpaque(window, false) or Window#setBackground(new Color(0, 0, 0, 0)).
// This problem appears on JDK-6(x86/amd64) and JDK-7(x86/amd64)
SwingUtilities.invokeLater(new Runnable() {
@Override
public void run() {
//final JFrame window = new JFrame();
//window.setUndecorated(true);
final JWindow window = new JWindow();
window.setLocation(200, 200);
window.setSize(300, 300);
final JLabel label = new JLabel("...click to invoke JPopupMenu");
label.setOpaque(true);
final JPanel contentPane = new JPanel(new BorderLayout());
contentPane.setBorder(BorderFactory.createLineBorder(Color.RED));
window.setContentPane(contentPane);
contentPane.add(label, BorderLayout.NORTH);
final JComboBox comboBox = new JComboBox(new Object[] {"1", "2", "3", "4"});
contentPane.add(comboBox, BorderLayout.SOUTH);
final JPopupMenu jPopupMenu = new JPopupMenu();
jPopupMenu.add("string");
jPopupMenu.add(new AbstractAction("action") {
@Override
public void actionPerformed(final ActionEvent e) {
}
});
jPopupMenu.add(new JLabel("label"));
jPopupMenu.add(new JMenuItem("MenuItem"));
label.addMouseListener(new MouseAdapter() {
@Override
public void mouseReleased(final MouseEvent e) {
jPopupMenu.show(label, 0, 0);
//jPopupMenu.repaint(); // this fixes JPopup painting in non-opaque Window's
}
});
// Window.setBackground(Color). Passing the new Color(0, 0, 0, 0) achieves the old effect of installing per-pixel translucency.
window.setBackground(new Color(0, 0, 0, 0));
window.setVisible(true);
}
});
}
}
---------- END SOURCE ----------
CUSTOMER SUBMITTED WORKAROUND :
Note: only for JPopupMenu not JCombobox
-----------------------------------------------------------------
after #show call repaint
jPopupMenu.show(label, 0, 0);
jPopupMenu.repaint(); // this fixes JPopup painting in non-opaque Window's
Same issue had been reported by a CAP member:
we experience many issues with tansclucent windows with JDK 7. All issues are
new and were working with JDK 6. We already cross-checked with JDK 8, still
broken.
The last version of the test case is attached(GuiTest_AwtUtilitiesWrapper.java)
This is a serious problem on all Windows systems. If heavyweight popup is
needed and D3D-Pipeline is not active. E.g. JComboBox-Popus are heavyweight
if they exceed the bounds of the window they are embedded in. Opacity is not
usable in current state. Attached "Translucent_windows.png" shows a non-working
windows system.
Hint: Test cases 2 and 3 at http://docs.oracle.com/javase/tutorial/uiswing/misc/trans_shaped_windows.html
are broken (in jnlp file for test case 2 the main class is missing, in test
case 3 the wrong main class is referenced). These test cases could be used to
show some of the issues. See attached screenshot "Translucent_ubuntu.png",
taken with Ubuntu 12.04 and Intel GMA graphics.
Another "translucent window issue":
On JWindows/JFrames on Linux/X11 using Nvidia Twin View (latest nvidia X11
graphics driver) - If your using non-opaque windows on Linux/X11 using Nvidia
Twin View (dual monitor setup) on X11 - Translucency of the JWindow is lost
immediately if moving the non-opaque JWindow from the primary screen to
secondary one. This happens only with jdk7u7 and before. With jdk6 all is
painted fine.
nvidia driver: 302.17
X11 version: 1.12.3 (11203000)
X11 version number: 11.0
nvidia- twin config: see screen attached "nvidia-driver-config.png"
java version "1.7.0_03"
Java(TM) SE Runtime Environment (build 1.7.0_03-b05)
Java HotSpot(TM) 64-Bit Server VM (build 22.1-b02, mixed mode)
ADDITIONAL OS VERSION INFORMATION :
Windows 7 64bit
A DESCRIPTION OF THE PROBLEM :
Using the new non-opaque windows feature -
Popups (JPopupMenu/JComboBox) are initially not painted correctly if the invoking/parent Window is non-opaque using AWTUtilities#setWindowOpaque(window, false) or Window#setBackground(new Color(0, 0, 0, 0)).
This problem appears on JDK-6(1.6.0_31 x86/amd64) and JDK-7(1.7.0_3 x86/amd64).
note:
On JDK-6(1.6.0_31 x86/amd64) the initial paiting is correct but after moving the mouse one or more times over the popup, parts of the popup arenÄ'T painted any more, e.g. the border.
REGRESSION. Last worked in version 7
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
Using the new non-opaque windows feature -
Popup-Menus are initially not painted correctly if the invoking/parent Window is non-opaque using AWTUtilities#setWindowOpaque(window, false) or Window#setBackground(new Color(0, 0, 0, 0)).
This problem appears on JDK-6(1.6.0_31 x86/amd64) and JDK-7(1.7.0_3 x86/amd64).
note:
On JDK-6(1.6.0_31 x86/amd64) the initial paiting is correct but after moving the mouse one or more times over the popup, parts of the popup arenÄ'T painted any more, e.g. the border.
EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
correct painted popups.
REPRODUCIBILITY :
This bug can be reproduced always.
---------- BEGIN SOURCE ----------
package de.espirit.firstspirit.client.gui.util;
import javax.swing.AbstractAction;
import javax.swing.BorderFactory;
import javax.swing.JComboBox;
import javax.swing.JLabel;
import javax.swing.JMenuItem;
import javax.swing.JPanel;
import javax.swing.JPopupMenu;
import javax.swing.JWindow;
import javax.swing.SwingUtilities;
import java.awt.BorderLayout;
import java.awt.Color;
import java.awt.event.ActionEvent;
import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent;
/**
* $Date$
*
* @version $Revision$
*/
public class TestAwtUtilities {
public static void main(final String[] args) {
// Using non-opaque windows -
// Popup-Menus are initially not painted correctly
// if the invoking/parent Window is non-opaque using AWTUtilities#setWindowOpaque(window, false) or Window#setBackground(new Color(0, 0, 0, 0)).
// This problem appears on JDK-6(x86/amd64) and JDK-7(x86/amd64)
SwingUtilities.invokeLater(new Runnable() {
@Override
public void run() {
//final JFrame window = new JFrame();
//window.setUndecorated(true);
final JWindow window = new JWindow();
window.setLocation(200, 200);
window.setSize(300, 300);
final JLabel label = new JLabel("...click to invoke JPopupMenu");
label.setOpaque(true);
final JPanel contentPane = new JPanel(new BorderLayout());
contentPane.setBorder(BorderFactory.createLineBorder(Color.RED));
window.setContentPane(contentPane);
contentPane.add(label, BorderLayout.NORTH);
final JComboBox comboBox = new JComboBox(new Object[] {"1", "2", "3", "4"});
contentPane.add(comboBox, BorderLayout.SOUTH);
final JPopupMenu jPopupMenu = new JPopupMenu();
jPopupMenu.add("string");
jPopupMenu.add(new AbstractAction("action") {
@Override
public void actionPerformed(final ActionEvent e) {
}
});
jPopupMenu.add(new JLabel("label"));
jPopupMenu.add(new JMenuItem("MenuItem"));
label.addMouseListener(new MouseAdapter() {
@Override
public void mouseReleased(final MouseEvent e) {
jPopupMenu.show(label, 0, 0);
//jPopupMenu.repaint(); // this fixes JPopup painting in non-opaque Window's
}
});
// Window.setBackground(Color). Passing the new Color(0, 0, 0, 0) achieves the old effect of installing per-pixel translucency.
window.setBackground(new Color(0, 0, 0, 0));
window.setVisible(true);
}
});
}
}
---------- END SOURCE ----------
CUSTOMER SUBMITTED WORKAROUND :
Note: only for JPopupMenu not JCombobox
-----------------------------------------------------------------
after #show call repaint
jPopupMenu.show(label, 0, 0);
jPopupMenu.repaint(); // this fixes JPopup painting in non-opaque Window's
Same issue had been reported by a CAP member:
we experience many issues with tansclucent windows with JDK 7. All issues are
new and were working with JDK 6. We already cross-checked with JDK 8, still
broken.
The last version of the test case is attached(GuiTest_AwtUtilitiesWrapper.java)
This is a serious problem on all Windows systems. If heavyweight popup is
needed and D3D-Pipeline is not active. E.g. JComboBox-Popus are heavyweight
if they exceed the bounds of the window they are embedded in. Opacity is not
usable in current state. Attached "Translucent_windows.png" shows a non-working
windows system.
Hint: Test cases 2 and 3 at http://docs.oracle.com/javase/tutorial/uiswing/misc/trans_shaped_windows.html
are broken (in jnlp file for test case 2 the main class is missing, in test
case 3 the wrong main class is referenced). These test cases could be used to
show some of the issues. See attached screenshot "Translucent_ubuntu.png",
taken with Ubuntu 12.04 and Intel GMA graphics.
Another "translucent window issue":
On JWindows/JFrames on Linux/X11 using Nvidia Twin View (latest nvidia X11
graphics driver) - If your using non-opaque windows on Linux/X11 using Nvidia
Twin View (dual monitor setup) on X11 - Translucency of the JWindow is lost
immediately if moving the non-opaque JWindow from the primary screen to
secondary one. This happens only with jdk7u7 and before. With jdk6 all is
painted fine.
nvidia driver: 302.17
X11 version: 1.12.3 (11203000)
X11 version number: 11.0
nvidia- twin config: see screen attached "nvidia-driver-config.png"
Attachments
Issue Links
- backported by
-
JDK-8043885 Using non-opaque windows - popups are initially not painted correctly
- Resolved
-
JDK-8061023 Using non-opaque windows - popups are initially not painted correctly
- Resolved
-
JDK-8057493 Using non-opaque windows - popups are initially not painted correctly
- Closed
- duplicates
-
JDK-8041731 JPopupMenu items invisible on heavyweight popups on translucent windows
- Resolved