Original Post
Can someone give me a tmeplate for a java class that creates an applet and uses the robot class?
Something like this:
or if you could tell me how to run an applet from main something like:
[edited by - vlovich on October 7, 2002 6:54:15 PM]
[edited by - vlovich on October 7, 2002 6:58:24 PM]
import java.awt.Robot;
import java.awt.Applet;
public class MyClass extends Applet
{
public void init() {
}
public void paint (Graphics g) {
// Uses Robot class here and gets pixel color for lets
// say pixel (0,0)
// For some reason the following code returns an error
// of something like "unreported exception
// java.awt.AWTException; must be caught or declared
// to be thrown"
Robot screen = new Robot();
screen.getPixelColor(0,0);
}
}
import java.awt.*;
import java.awt.swing.*;
import java.awt.event.*
public class MyClass
{
public static void main (String args[]){
}
JApplet app = new JApplet ();
// I then set the size and position and set
// visible to true. Applet doesn't show up.
}
}