资源简介
大体实现了汉诺塔java语言下图形用户界面的动画功能,面向对象设计了三个简单的类,但很多细节还有待完善,可供参考,VERSION 1.0
代码片段和文件信息
public class Disk {
private int height;
private int width;
private int number;
public Disk(){
height = 0;
width = 0;
number = 0;
}
public Disk(int number){
this.height = HanoiJPanel.getHEIGHTOFDISK();
this.width = HanoiJPanel.getWIDTHOFDISK()*(number+1);
this.number = number;
}
public Disk(int heightint widthint number){
this.height = height;
this.width = width;
this.number = number;
}
public int getNumber(){
return number;
}
public boolean equals(Disk d){
return this==d;
}
public int getWidth(){
return width;
}
public int getHeight(){
return height;
}
/*public String toString(){
System.out.println(“height: “ + height+
“width: “ + width +
“number: “ + number);
}*/
public String toString(){
String s = “height: “ + height + “width: “ + width + “number: “ + number + ‘\n‘;
return s;
}
}
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
文件 301 2015-03-05 16:33 HanoiTower\.classpath
文件 386 2015-03-05 16:33 HanoiTower\.project
文件 598 2015-03-05 16:33 HanoiTower\.settings\org.eclipse.jdt.core.prefs
文件 1464 2015-03-08 09:21 HanoiTower\bin\Disk.class
文件 594 2015-03-08 18:40 HanoiTower\bin\Hanoif
文件 4661 2015-03-08 18:40 HanoiTower\bin\Hanoif
文件 1985 2015-03-08 17:46 HanoiTower\bin\HanoiJPanel.class
文件 21795 2015-03-08 18:39 HanoiTower\bin\image\icons.png
文件 1582 2015-03-08 17:54 HanoiTower\bin\StackOfDisks.class
文件 966 2015-03-08 09:21 HanoiTower\src\Disk.java
文件 5417 2015-03-08 18:40 HanoiTower\src\Hanoif
文件 3231 2015-03-08 17:46 HanoiTower\src\HanoiJPanel.java
文件 21795 2015-03-08 18:15 HanoiTower\src\icons.png
文件 21795 2015-03-08 18:15 HanoiTower\src\image\icon.png
文件 21795 2015-03-08 18:39 HanoiTower\src\image\icons.png
文件 738 2015-03-08 17:54 HanoiTower\src\StackOfDisks.java
目录 0 2015-03-08 18:39 HanoiTower\bin\image
目录 0 2015-03-08 18:39 HanoiTower\src\image
目录 0 2015-03-05 16:33 HanoiTower\.settings
目录 0 2015-03-08 18:13 HanoiTower\bin
目录 0 2015-03-08 18:39 HanoiTower\src
目录 0 2015-03-05 16:33 HanoiTower
----------- --------- ---------- ----- ----
109103 22
评论
共有 条评论