-
Bug
-
Resolution: Fixed
-
P2
-
7
-
b116
-
x86
-
windows_xp
-
Verified
method java.awt.Window.setOpacity(float opacity)
declares:
* @throws IllegalComponentStateException if the window is in full screen
* mode, and the opacity is less than 1.0f
This is not true if using two-monitor configuration on WindowsXP(SP3).
Please see the following code sample with extended console output:
-------------------------------------------
import javax.swing.*;
import java.util.Arrays;
import java.awt.*;
import static java.lang.System.out;
public class Temp {
public static void main(String[] args) throws Exception {
SwingUtilities.invokeLater(new Runnable() {
@Override
public void run() {
GraphicsEnvironment ge = GraphicsEnvironment.getLocalGraphicsEnvironment();
GraphicsDevice[] devices = ge.getScreenDevices();
out.println("Arrays.toString(devices) = " + Arrays.toString(devices));
Frame window = new Frame();
window.setBackground(Color.RED);
GraphicsDevice device = devices[0];
out.println("using device " + device);
device.setFullScreenWindow(window);
out.println("device.getFullScreenWindow() = " + device.getFullScreenWindow());
try {
window.setOpacity(0.1f);
out.println("no IllegalComponentStateException !!!");
GraphicsConfiguration gc = window.getGraphicsConfiguration();
GraphicsDevice gd = gc.getDevice();
out.println("gd = " + gd);
out.println("window = " + window);
out.println("gc.getDevice().getFullScreenWindow() = " + gc.getDevice().getFullScreenWindow());
out.println("(window == gc.getDevice().getFullScreenWindow()) == " + (window == gc.getDevice().getFullScreenWindow()));
} catch (IllegalComponentStateException e) {
out.println("IllegalComponentStateException - ok");
}
window.dispose();
}
});
}
}
-------------------------------------------
The output is:
Arrays.toString(devices) = [Win32GraphicsDevice[screen=0], Win32GraphicsDevice[screen=1]]
using device Win32GraphicsDevice[screen=0]
device.getFullScreenWindow() = java.awt.Frame[frame0,1280,0,1280x1024,layout=java.awt.BorderLayout,title=,resizable,normal]
no IllegalComponentStateException !!!
gd = Win32GraphicsDevice[screen=1]
window = java.awt.Frame[frame0,1280,0,1280x1024,layout=java.awt.BorderLayout,title=,resizable,normal]
gc.getDevice().getFullScreenWindow() = null
(window == gc.getDevice().getFullScreenWindow()) == false
declares:
* @throws IllegalComponentStateException if the window is in full screen
* mode, and the opacity is less than 1.0f
This is not true if using two-monitor configuration on WindowsXP(SP3).
Please see the following code sample with extended console output:
-------------------------------------------
import javax.swing.*;
import java.util.Arrays;
import java.awt.*;
import static java.lang.System.out;
public class Temp {
public static void main(String[] args) throws Exception {
SwingUtilities.invokeLater(new Runnable() {
@Override
public void run() {
GraphicsEnvironment ge = GraphicsEnvironment.getLocalGraphicsEnvironment();
GraphicsDevice[] devices = ge.getScreenDevices();
out.println("Arrays.toString(devices) = " + Arrays.toString(devices));
Frame window = new Frame();
window.setBackground(Color.RED);
GraphicsDevice device = devices[0];
out.println("using device " + device);
device.setFullScreenWindow(window);
out.println("device.getFullScreenWindow() = " + device.getFullScreenWindow());
try {
window.setOpacity(0.1f);
out.println("no IllegalComponentStateException !!!");
GraphicsConfiguration gc = window.getGraphicsConfiguration();
GraphicsDevice gd = gc.getDevice();
out.println("gd = " + gd);
out.println("window = " + window);
out.println("gc.getDevice().getFullScreenWindow() = " + gc.getDevice().getFullScreenWindow());
out.println("(window == gc.getDevice().getFullScreenWindow()) == " + (window == gc.getDevice().getFullScreenWindow()));
} catch (IllegalComponentStateException e) {
out.println("IllegalComponentStateException - ok");
}
window.dispose();
}
});
}
}
-------------------------------------------
The output is:
Arrays.toString(devices) = [Win32GraphicsDevice[screen=0], Win32GraphicsDevice[screen=1]]
using device Win32GraphicsDevice[screen=0]
device.getFullScreenWindow() = java.awt.Frame[frame0,1280,0,1280x1024,layout=java.awt.BorderLayout,title=,resizable,normal]
no IllegalComponentStateException !!!
gd = Win32GraphicsDevice[screen=1]
window = java.awt.Frame[frame0,1280,0,1280x1024,layout=java.awt.BorderLayout,title=,resizable,normal]
gc.getDevice().getFullScreenWindow() = null
(window == gc.getDevice().getFullScreenWindow()) == false
- duplicates
-
JDK-6838942 java.awt.Window.setShape() doesn't throw IllegalComponentStateException for two-display conf
- Closed
-
JDK-6838947 java.awt.Window.setBackground() doesn't throw IllegalComponentStateException for two-display conf
- Closed