我想在程序的JFrame上显示我的屏幕的完整屏幕截图。 到目前为止,使用下面的代码,我只能够显示部分屏幕。 下面的代码是油漆的内容(图形g)。 如何让它全屏?Java Full Screenshot
// the screen resolution is 1280 x 1024 while the JPanel size is only 1024 x 768
Dimension resolution = Toolkit.getDefaultToolkit().getScreenSize();
Rectangle rectangle = new Rectangle(resolution);
robot = new Robot();
BufferedImage bufferedImage = robot.createScreenCapture(rectangle);
g.drawImage(bufferedImage.getScaledInstance(bufferedImage.getWidth(), bufferedImage.getHeight(), Image.SCALE_DEFAULT), 0, 0, null);
嗯,你为什么不使用'新尺寸(1280,1024 )'而不是?或者我错过了什么? – BalusC 2011-06-01 03:03:14
我放错了代码。我立即更新了它们。 – 2011-06-01 03:08:28
我还是不明白具体问题。 – BalusC 2011-06-01 03:45:21