Last active
October 13, 2015 10:33
-
-
Save YSRKEN/f8b8ef722dfdab5da826 to your computer and use it in GitHub Desktop.
Javaで艦これ用スクショツールを作ってみた その1 ref: http://qiita.com/YSRKEN/items/ac75ffcb0f72adbd2a7f
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
try{ | |
// すべてのグラフィックデバイスを取得する | |
GraphicsDevice[] all_gd = GraphicsEnvironment.getLocalGraphicsEnvironment().getScreenDevices(); | |
for(GraphicsDevice gd : all_gd){ | |
// 各グラフィックデバイスにおけるグラフィックス特性を取得する | |
GraphicsConfiguration[] all_gc = gd.getConfigurations(); | |
// 各グラフィックス特性に従い、その座標を取得してスクショを撮る | |
Robot robot = new Robot(gd); | |
for(GraphicsConfiguration gc : all_gc){ | |
BufferedImage images = robot.createScreenCapture(gc.getBounds()); | |
} | |
} | |
} | |
catch(Exception error){ | |
error.printStackTrace(); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment