资 源 简 介
import java.awt.**;
import java.applet.**;
public class Guns extends Applet
{
int mouseX,mouseY,clicks;
boolean mouseIn;
public boolean mouseDown(Event evt,int x,int y)
{
clicks=clicks+1;
mouseX=x;
mouseY=y;
repaint ();
return true;
}
public boolean mouseEnter(Event evt,int x,int y)
{
mouseIn=true;
repaint();
return true;
}
public boolean mouseExit(Event evt,int x,int y)
{
mouseIn=false;
repaint();
return true;
}
Image pic1,pic2;
public void init()
{
pic1=getImage(getCodeBase(),"gun.jpg");
pic2=getImage(getCodeBase(),"peluru.jpg");
}
public void paint (Graphics g)
{
g.drawImage(pic1,10,20,this);
g.drawImage(pic2,30+clicks*50,40,this);
//g.drawImage(pic2,20,70,this);
//g.drawImage(pic3,140,130,this);<