⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 towerpoint.java

📁 程序简明清晰
💻 JAVA
字号:
import java.awt.*;
public class TowerPoint
{
   int x,y;                  
   boolean 有盘子;           
   Disk 盘子=null;           
   HannoiTower con=null;     
   public TowerPoint(int x,int y,boolean boo)
   {
      this.x=x;     //调用当前对象
      this.y=y;     //调用当前对象
      有盘子=boo;   
   }
  public boolean 是否有盘子()
  {
    return 有盘子;   //返回有盘子时候的值
  }
  public void set有盘子(boolean boo)
  {
    有盘子=boo;      //存储这个值
  }
 
  public int getX()
  {
    return x;
  }
  public int getY()
  {
    return y;
  }
  public void 放置盘子(Disk 盘子,HannoiTower con)  //放置盘子
  {
     this.con=con;         //调用当前对象
     con.setLayout(null);
     this.盘子=盘子;       //调用当前对象
     con.add(盘子);        
     int w=盘子.getBounds().width;
     int h=盘子.getBounds().height;
     盘子.setBounds(x-w/2,y-h/2,w,h);
     有盘子=true;
     con.validate(); 
  }
  public Disk 获取盘子()
  {
     return 盘子;
  }
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -