United StatesChange Country, Oracle Worldwide Web Sites Communities I am a... I want to...
JDK-8006421 : GraphicsConfiguration of a frame is changed when the frame is moved to another screen

Details
Type:
Bug
Submit Date:
2013-01-16
Status:
Open
Updated Date:
2014-04-16
Project Name:
JDK
Resolved Date:
Component:
client-libs
OS:
linux
Sub-Component:
java.awt
CPU:
Priority:
P4
Resolution:
Unresolved
Affected Versions:
7
Targeted Versions:
tbd_major

Related Reports

Sub Tasks

Description
Originally reported at: http://www.java.net/forum/topic/javadesktop/java-desktop-technologies/swing-awt/problem-graphicsconfiguration-frame

*************************************************************************
I have a simple program which builds a frame with a specific GraphicsConfiguration.
 When I launch this program on Linux and Java1.7 with multiscreens (TwinView), the GraphicsConfiguration of my frame changes to default configuration if it is moved onto the second screen.
 Why the default configuration is restored ? With Java1.6, this change doesn't occur.
*************************************************************************

Note that this may or may not be a bug. However, since the behavior has changed since 1.6, we should evaluate whether it is an expected change.
                                    

Comments
As replied on the forum, different screens may have different graphics configs, so the change is expected. However, we should make sure that if a translucency-capable GraphicsConfig was explicitly specified by application, and the new screen also provides translucency-capable GraphicsConfig, this config should be chosen, otherwise the window will become opaque. If this is true, the bug must be closed as not a defect.
                                     
2013-01-21
More details from a forum post in that thread:

*************************************************************************
I've tested with a translucent window (GradientTranslucentWindowDemo from "How to Create Translucent and Shaped Windows" tutorial).
On the first screen, a translucency-capable GraphicsConfig is found and it is not the default one (GraphicsDevice.getTranslucencyCapableGC()). To check graphics configurations, I print visual IDs: Default GC = 33, Frame GC = 284.
When the window is moved to the second screen, visual IDs: Default GC = 33, Frame GC = 33.
The GC of the frame is the default GC.
If I move my frame back to the first screen, visual IDs: Default GC = 33, Frame GC = 33.
The translucency-capable GraphicsConfig is never restored.

So, for me, this is a bug, I think the chosen GraphicsConfig must be closest to the GC explicitly specified by the application.
*************************************************************************

Since the window is transparent, I'd imagine it should choose a translucency-capable GC when moved back to a screen that provides one. Perhaps, even if we reset the transparent status of a window, we should nevertheless preserve it in a private field, and take into account when the window is moved to a new screen to choose the right GC for that window.

In any case we should investigate why this wasn't a problem for Java 1.6 and see if we can restore the old behavior.
                                     
2013-04-30



Hardware and Software, Engineered to Work Together