• 大小: 70KB
    文件类型: .rar
    金币: 1
    下载: 0 次
    发布日期: 2021-06-06
  • 语言: Java
  • 标签: 动物换位  

资源简介

动物换位是一个小游戏,通过左右动物互换位置,并计时,有三级,游戏规则也简单

资源截图

代码片段和文件信息

package dd;
import javax.swing.*;
import java.awt.*;
import java.io.*;
public class Animal extends JPanel{
   Point point;
   boolean isLeft;
   Toolkit tool;
   File leftImagerightImage; 
   Animal(){
       tool=getToolkit();
   }
   public void setLeftImage(File f){
       leftImage=f;
   }
 
   public void setRightImage(File f){
       rightImage=f;
   }
   public void setIsLeft(boolean boo){
       isLeft=boo;
   }
   public boolean  getIsLeft(){
       return isLeft;
   }
   public void setAtPoint(Point p){
      point=p;
   }
   public Point getAtPoint(){
      return point;
   }
   public void paintComponent(Graphics g){
      super.paintComponent(g);  
      int w=getBounds().width;
      int h=getBounds().height;
      try{ 
         if(isLeft==true){
            Image image=tool.getImage(leftImage.toURI().toURL());    
            g.drawImage(image00whthis);
         }
         else{       
            Image image=tool.getImage(rightImage.toURI().toURL());
            g.drawImage(image00whthis); 
         }
      }
      catch(Exception exp){}
   }

}

 属性            大小     日期    时间   名称
----------- ---------  ---------- -----  ----

     文件        226  2009-12-27 01:54  dd\.classpath

     文件        380  2009-12-27 01:54  dd\.project

     文件       1295  2009-12-29 14:25  dd\Animal.class

     文件       1138  2009-12-29 14:16  dd\Animal.java

     文件       3198  2009-12-29 14:25  dd\AutoMoveAnimal.class

     文件       9013  2009-12-29 14:16  dd\AutoMoveAnimal.java

     文件       3360  2008-05-06 22:57  dd\cat.jpg

     文件       3100  2009-12-29 14:25  dd\ChangeAnimalWindow.class

     文件      12805  2009-12-29 14:16  dd\ChangeAnimalWindow.java

     文件      55776  2008-04-14 12:00  dd\chimes.wav

     文件       4991  2007-05-07 14:18  dd\cool.jpg

     文件       3567  2008-05-09 08:44  dd\dog.jpg

     文件       3086  2009-12-29 14:25  dd\HandleMouse.class

     文件       4935  2009-12-29 14:16  dd\HandleMouse.java

     文件       1169  2009-12-29 14:25  dd\HandleQuit.class

     文件       1055  2009-12-29 14:16  dd\HandleQuit.java

     文件       2982  2007-06-05 07:24  dd\pig.jpg

     文件       1391  2009-12-29 14:25  dd\Point.class

     文件        935  2009-12-29 14:16  dd\Point.java

     文件        423  2009-12-29 14:25  dd\Stone.class

     文件        224  2009-12-29 14:16  dd\Stone.java

     文件       4063  2008-11-22 08:59  dd\stone.jpg

     目录          0  2009-12-29 14:25  dd

----------- ---------  ---------- -----  ----

               119112                    23


评论

共有 条评论