JAVA 初学者 的 问题 急! thanks!

lara0319 2008-02-03 10:14:22
是一个作业,画枫叶

/*
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.
}
}
...全文
93 2 打赏 收藏 转发到动态 举报
写回复
用AI写文章
2 条回复
切换为时间正序
请发表友善的回复…
发表回复
  • 打赏
  • 举报
回复
我已经弄明白你的问题了,相关的解决方法要怎么告诉你。
但是你的代码中的要求不是要求画一颗五角星么?
/*
Uses the java.awt.robot class to draw a five-point star
in a window of a separate drawing application.
*/[code]
所以五角星很容易画出来,但是枫叶的话,需要画的线比较多,本人的艺术天赋不好,就告诉你方法然后你自己画吧
我的邮箱是libai8723@163.com,我可以把解决方法和代码给你(附图)
lara0319 2008-02-03
  • 打赏
  • 举报
回复
我的MSN:
larav00009@hotmail.com

thanks!!!!

62,623

社区成员

发帖
与我相关
我的任务
社区描述
Java 2 Standard Edition
社区管理员
  • Java SE
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧