Screen Scrap an Applet

I

IchBin

John said:
Know any references for how to screen scape an applet?

public class ScreenShot
{
public static void main(String[] args)
{
try
{
// Get the screen size
Dimension screenSize =
Toolkit.getDefaultToolkit().getScreenSize();
Rectangle rectangle = new Rectangle(0, 0, screenSize.width,
screenSize.height);
Robot robot = new Robot();
BufferedImage image = robot.createScreenCapture(rectangle);
File file;

// Save the screenshot as a png
file = new File("screen.png");
ImageIO.write(image, "png", file);

} catch (Exception e)
{
System.out.println(e.getMessage());
}
}
}


--

Thanks in Advance...
IchBin, Pocono Lake, Pa, USA
http://weconsultants.servebeer.com/JHackerAppManager
__________________________________________________________________________

'If there is one, Knowledge is the "Fountain of Youth"'
-William E. Taylor, Regular Guy (1952-)
 
T

Thomas Hawtin

IchBin said:
John said:
Know any references for how to screen scape an applet?

[...]
BufferedImage image = robot.createScreenCapture(rectangle);
[...]

I think you'd be better off supplying a custom Graphics object rather
than trying to do character recognition.

Tom Hawtin
 
I

IchBin

Thomas said:
IchBin said:
John said:
Know any references for how to screen scape an applet?

[...]
BufferedImage image = robot.createScreenCapture(rectangle);
[...]

I think you'd be better off supplying a custom Graphics object rather
than trying to do character recognition.

Tom Hawtin

Sorry Tom, why is that.. using the robot.createScreenCapture() has
worked for me. What are some of the implications for doing it this way.
What would be an example for coding a graphics object or just point me
into the right direction, I'd be interested.

Thanks in Advance...
IchBin, Pocono Lake, Pa, USA
http://weconsultants.servebeer.com/JHackerAppManager
__________________________________________________________________________

'If there is one, Knowledge is the "Fountain of Youth"'
-William E. Taylor, Regular Guy (1952-)
 
T

Thomas Hawtin

IchBin said:
Thomas said:
IchBin said:
John A. Bailo wrote:


Know any references for how to screen scape an applet?


[...]
BufferedImage image = robot.createScreenCapture(rectangle);
[...]


I think you'd be better off supplying a custom Graphics object rather
than trying to do character recognition.

Sorry Tom, why is that.. using the robot.createScreenCapture() has
worked for me. What are some of the implications for doing it this way.
What would be an example for coding a graphics object or just point me
into the right direction, I'd be interested.

Using Robot is fine if you have a dedicated machine, and are interested
in bitmaps rather than text and vector graphics.

To get the raw text, for instance, get the applet to paint itself to one
of your Graphics (or Graphics2D) objects. In the implementation of
Graphics.drawString, capture the text and do with it what you will.
Obviously, there is a degree of set up required to run the applet
outside of a conventional applet viewer.

Tom Hawtin
 
I

IchBin

Thomas said:
IchBin said:
Thomas said:
IchBin wrote:

John A. Bailo wrote:


Know any references for how to screen scape an applet?


[...]
BufferedImage image = robot.createScreenCapture(rectangle);
[...]


I think you'd be better off supplying a custom Graphics object rather
than trying to do character recognition.

Sorry Tom, why is that.. using the robot.createScreenCapture() has
worked for me. What are some of the implications for doing it this
way. What would be an example for coding a graphics object or just
point me into the right direction, I'd be interested.

Using Robot is fine if you have a dedicated machine, and are interested
in bitmaps rather than text and vector graphics.

To get the raw text, for instance, get the applet to paint itself to one
of your Graphics (or Graphics2D) objects. In the implementation of
Graphics.drawString, capture the text and do with it what you will.
Obviously, there is a degree of set up required to run the applet
outside of a conventional applet viewer.

Tom Hawtin

Thanks Tom for the info..

--

Thanks in Advance...
IchBin, Pocono Lake, Pa, USA
http://weconsultants.servebeer.com/JHackerAppManager
__________________________________________________________________________

'If there is one, Knowledge is the "Fountain of Youth"'
-William E. Taylor, Regular Guy (1952-)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,744
Messages
2,569,484
Members
44,903
Latest member
orderPeak8CBDGummies

Latest Threads

Top