| JDK 21 |
|---|
| 21Resolved |
|
Duplicate :
|
|
|
Duplicate :
|
|
|
Relates :
|
|
|
Relates :
|
ADDITIONAL SYSTEM INFORMATION :
Tried on Debian11 (bullseye) and Debian10 (buster) with default Gnome3 desktop
On Debian11 tried with these openjdk java versions:
- "17-ea" 2021-09-14
- "14.0.2" 2020-07-14
- "13.0.5.1" 2020-11-06
- "11.0.11" 2021-04-20
A DESCRIPTION OF THE PROBLEM :
When I try to take a screenshot using java.awt.Robot, then in any case this produces just a black image.
Same bad result using javafx.scene.robot.Robot.
Also getPixelColor​(x,y) always returns black.
But getPixelColor​(x,y) returns any wrong color, when this argument is set: -Dawt.robot.gtk=false
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
Just try to take a screenshot on any Debian OS with Gnome3, it is always black.
EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
This function should return an Image containing the recorded screenshot.
ACTUAL -
Black image.
---------- BEGIN SOURCE ----------
public class Test
{
public static void main (String args[]) throws Exception
{
java.awt.Robot robot = new java.awt.Robot();
java.awt.Toolkit tk = java.awt.Toolkit.getDefaultToolkit();
java.awt.Rectangle rect = new java.awt.Rectangle(tk.getScreenSize());
java.awt.image.BufferedImage im = robot.createScreenCapture(rect);
javax.imageio.ImageIO.write(im, "png", new java.io.File("/tmp/screen.png"));
}
}
---------- END SOURCE ----------
FREQUENCY : always
|