我用drawLine()方法画线,现在想删除线,怎么办?我在Greenfoot API中找不到任何方法。请帮助!
import greenfoot.*; // (World, Actor, GreenfootImage, Greenfoot and MouseInfo)
import java.awt.Color;
import java.lang.Thread;
/**
* Write a description of class pen here.
*
* @author (your name)
* @version (a version number or a date)
*/
public class pen extends Actor
{
/**
* Act - do whatever the pen wants to do. This method is called whenever
* the 'Act' or 'Run' button gets pressed in the environment.
*/
private TestWorld world;
private GreenfootImage image;
public pen()
{
}
public void act()
{
// Add your action code here.
try{
Thread.sleep(5000);
}catch(Exception e){}
world=(TestWorld)this.getWorld();
image=world.getBackground();
image.setColor(Color.RED);
image.drawLine(0,0,getX(),getY());
}
}