JAVA 初学者 的 问题 急! thanks!
是一个作业,画枫叶
/*
Author: <insert your name here>
Ugrad lab login ID: <insert your ugrad lab (ICCS 008) login ID here>
Date: <insert date here>
By submitting this file, I acknowledge that the person whose name appears
above is the sole author of this file except as acknowledged below.
*/
import java.awt.*;
import java.util.Scanner;
/*
Uses the java.awt.robot class to draw a five-point star
in a window of a separate drawing application.
*/
public class RobotMaple
{
public static void main(String[] args) throws AWTException
// You can ignore this "throws AWTException" stuff for now...
{
// Create a Robot object for us to control the screen.
Robot robot = new Robot();
// Creat a Scanner object, to simplify reading input from the user.
Scanner in = new Scanner(System.in);
// Adjust the speed of robots actions.
final int ROBOT_DELAY = 500; // Delay between events in milliseconds.
robot.setAutoDelay(ROBOT_DELAY);
robot.setAutoWaitForIdle(true);
// Your code goes here...
// This is some sample robot code, just to demonstrate.
// This code will move the mouse to four points, clockwise
// around a square in the upper left of your screen.
robot.mouseMove(200,200);
robot.mouseMove(300,200);
robot.mouseMove(300,300);
robot.mouseMove(200,300);
robot.mouseMove(200,200);
// The following command makes the system think you pushed down
// the left button on the mouse. I'm leaving it commented out,
// because pushing a mouse button might cause something to happen
// on your screen.
// robot.mousePress(java.awt.event.InputEvent.BUTTON1_MASK);
// The next command releases the left mouse button.
// robot.mouseRelease(java.awt.event.InputEvent.BUTTON1_MASK);
// Similarly, the next events are for pressing and releasing
// a key on the keyboard (in this case, the letter a)
// robot.keyPress(java.awt.event.KeyEvent.VK_A);
// robot.keyRelease(java.awt.event.KeyEvent.VK_A);
// It might be helpful to know that VK_PERIOD is for the
// period key on your keyboard, VK_SLASH is for the forward
// slash, VK_SHIFT is for a shift key, and VK_SEMICOLON is
// for the semi-colon key. There's a big list at
// http://http://java.sun.com/j2se/1.5.0/docs/api/java/awt/event/KeyEvent.html
// You won't use these for this assignment, but they're handy to know.
}
}