-
Bug
-
Resolution: Fixed
-
P3
-
7
-
b142
-
generic
-
windows
-
Verified
The following method
http://download.java.net/jdk7/docs/api/java/awt/GraphicsDevice.html#setFullScreenWindow%28java.awt.Window%29
doesn't say anything about decorated or undecorated frames when entering exclusive full screen mode.
OS: Windows 7.
Visually in exclusive fullscreen mode decorated and undecorated frames are equal,
but if java.awt.Robot is used (method createScreenCapture())
pixel colors picked for example at (0,0) are different for decorated and undecorated frames in exclusive full screen mode.
(Experiments show that using Frame.getInsets() is helpful for determining area where pixel checking could be done without problems)
(Also pixel picking for JFrame contents doesn't work at all)
Please see the following code sample:
import javax.swing.*;
import java.awt.*;
public class DecoratedFrameFullScreen {
public static void main(String[] args) throws Exception {
final GraphicsDevice d = GraphicsEnvironment
.getLocalGraphicsEnvironment()
.getScreenDevices()[0];
System.out.println("d.isFullScreenSupported() = " + d.isFullScreenSupported());
final Robot robot = new Robot(d);
final Frame[] frame = new Frame[1];
SwingUtilities.invokeAndWait(new Runnable() {
@Override
public void run() {
frame[0] = new Frame();
// UNCOMMENT THIS TO PICK RED
//frame[0].setUndecorated(true);
frame[0].setBackground(Color.RED);
d.setFullScreenWindow(frame[0]);
}
});
Thread.sleep(3000);
SwingUtilities.invokeAndWait(new Runnable() {
@Override
public void run() {
getColorAt(robot, 0, 0);
getColorAt(robot, 50, 0);
getColorAt(robot, 0,50);
getColorAt(robot,
d.getDisplayMode().getWidth()-1,
d.getDisplayMode().getHeight()-1);
getColorAt(robot,
d.getDisplayMode().getWidth()-50,
d.getDisplayMode().getHeight()-1);
getColorAt(robot,
d.getDisplayMode().getWidth() - 1,
d.getDisplayMode().getHeight() - 50);
}
});
SwingUtilities.invokeAndWait(new Runnable() {
@Override
public void run() {
d.setFullScreenWindow(null);
}
});
frame[0].dispose();
}
private static void getColorAt(Robot robot, int x, int y) {
Color pickedColor = new Color(
robot.createScreenCapture(
new Rectangle(x, y, 1, 1)).getRGB(0, 0));
System.out.println(x + ", " + y + " - " + pickedColor);
}
}
-------------------------------------
The output will look like
d.isFullScreenSupported() = true
0, 0 - java.awt.Color[r=133,g=127,b=129]
50, 0 - java.awt.Color[r=37,g=32,b=36]
0, 50 - java.awt.Color[r=35,g=31,b=34]
1679, 1049 - java.awt.Color[r=16,g=18,b=8]
1630, 1049 - java.awt.Color[r=9,g=9,b=7]
1679, 1000 - java.awt.Color[r=35,g=32,b=35]
http://download.java.net/jdk7/docs/api/java/awt/GraphicsDevice.html#setFullScreenWindow%28java.awt.Window%29
doesn't say anything about decorated or undecorated frames when entering exclusive full screen mode.
OS: Windows 7.
Visually in exclusive fullscreen mode decorated and undecorated frames are equal,
but if java.awt.Robot is used (method createScreenCapture())
pixel colors picked for example at (0,0) are different for decorated and undecorated frames in exclusive full screen mode.
(Experiments show that using Frame.getInsets() is helpful for determining area where pixel checking could be done without problems)
(Also pixel picking for JFrame contents doesn't work at all)
Please see the following code sample:
import javax.swing.*;
import java.awt.*;
public class DecoratedFrameFullScreen {
public static void main(String[] args) throws Exception {
final GraphicsDevice d = GraphicsEnvironment
.getLocalGraphicsEnvironment()
.getScreenDevices()[0];
System.out.println("d.isFullScreenSupported() = " + d.isFullScreenSupported());
final Robot robot = new Robot(d);
final Frame[] frame = new Frame[1];
SwingUtilities.invokeAndWait(new Runnable() {
@Override
public void run() {
frame[0] = new Frame();
// UNCOMMENT THIS TO PICK RED
//frame[0].setUndecorated(true);
frame[0].setBackground(Color.RED);
d.setFullScreenWindow(frame[0]);
}
});
Thread.sleep(3000);
SwingUtilities.invokeAndWait(new Runnable() {
@Override
public void run() {
getColorAt(robot, 0, 0);
getColorAt(robot, 50, 0);
getColorAt(robot, 0,50);
getColorAt(robot,
d.getDisplayMode().getWidth()-1,
d.getDisplayMode().getHeight()-1);
getColorAt(robot,
d.getDisplayMode().getWidth()-50,
d.getDisplayMode().getHeight()-1);
getColorAt(robot,
d.getDisplayMode().getWidth() - 1,
d.getDisplayMode().getHeight() - 50);
}
});
SwingUtilities.invokeAndWait(new Runnable() {
@Override
public void run() {
d.setFullScreenWindow(null);
}
});
frame[0].dispose();
}
private static void getColorAt(Robot robot, int x, int y) {
Color pickedColor = new Color(
robot.createScreenCapture(
new Rectangle(x, y, 1, 1)).getRGB(0, 0));
System.out.println(x + ", " + y + " - " + pickedColor);
}
}
-------------------------------------
The output will look like
d.isFullScreenSupported() = true
0, 0 - java.awt.Color[r=133,g=127,b=129]
50, 0 - java.awt.Color[r=37,g=32,b=36]
0, 50 - java.awt.Color[r=35,g=31,b=34]
1679, 1049 - java.awt.Color[r=16,g=18,b=8]
1630, 1049 - java.awt.Color[r=9,g=9,b=7]
1679, 1000 - java.awt.Color[r=35,g=32,b=35]
- relates to
-
JDK-7032830 GraphicsDevice.setFullScreenWindow() works strange for decorated windows on OEL.
-
- Closed
-