티스토리 뷰

[자바] 프로그램상으로 화면캡쳐하기.

  GraphicsEnvironment ge = GraphicsEnvironment.getLocalGraphicsEnvironment();
 GraphicsDevice[] gs = ge.getScreenDevices();
 DisplayMode mode = gs[0].getDisplayMode();
 Rectangle bounds = new Rectangle(0, 0, mode.getWidth(), mode.getHeight());
 BufferedImage desktop = new BufferedImage(mode.getWidth(), mode.getHeight(),
BufferedImage.TYPE_INT_RGB);
  try {
   desktop = new Robot(gs[0]).createScreenCapture(bounds);
 }catch(AWTException e) {
 System.err.println("Screen capture failed.");
 }
And use the variable 'desktop' as you want.

끝. 
공지사항
최근에 올라온 글
최근에 달린 댓글
Total
Today
Yesterday
«   2024/12   »
1 2 3 4 5 6 7
8 9 10 11 12 13 14
15 16 17 18 19 20 21
22 23 24 25 26 27 28
29 30 31
글 보관함