🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: borland.public.jbuilder.java.swing
Article #8296

capture screen in java

#8296
From: Kenny
Date: Sun, 01 Oct 2000 00:00
31 lines
1244 bytes
Hi,
    I want to know how can i capture the screen in java, when i use
following part of code in  my applet, then it will said that unable to
construct Robot, but before i add this part of the code, my applet can
run it normally.

The part of the code:

import java.awt.*;
import java.awt.event.*;
import java.awt.image.*;
import java.applet.*;
import javax.swing.*;

....
public void update(Graphics g){
    Robot robot;
    Rectangle cap_screen_rec;

  try{
   robot = new Robot();
  }
  catch(Exception e){throw new RuntimeException
   ("unable to construct Robot");
  }
   cap_screen_rec = new Rectangle(0, 0, 100, 100);
   Image offscreen = robot.createScreenCapture(cap_screen_rec);
.....}
....}

Kenny
Technical Details
Message-ID: <39D746AC.32C80FAD@sinatown.com>
Path: arc1-ca.pugleaf.net!unknown!not-for-mail

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: 111d45,22622eae38e405ae,start
X-Google-Attributes: gid111d45,public
From: Kenny <kennypoon@sinatown.com>
Subject: capture screen in java
Date: 2000/10/01
Message-ID: <39D746AC.32C80FAD@sinatown.com>
X-Deja-AN: 676194723
Content-Transfer-Encoding: 7bit
X-Accept-Language: en
Content-Type: text/plain; charset=us-ascii
X-Trace: 1 Oct 2000 07:07:39 -0800, 202.64.17.29
MIME-Version: 1.0
Newsgroups: borland.public.jbuilder.java.swing