📄 hanoi.java
字号:
/* Java Applet generated by CGLIB of B-Prolog */
import java.awt.*;
import java.applet.Applet;
import java.awt.event.*;
import java.net.*;
import java.net.*;
public class Hanoi extends Applet {
boolean repeat = false;
public void start(){repeat = true; }
public void stop(){repeat = false; }
public void init(){
setLayout(null);
}
public void paint(Graphics g){
while (repeat) {
{
g.setColor(this.getBackground());
Rectangle r = getBounds();
g.fillRect(r.x,r.y,r.width,r.height);
}
g.setColor(new Color(-16777216));
g.fillRect(0,450,450,30);
g.setColor(new Color(-65536));
g.fillRect(60,0,30,450);
g.fillRect(210,0,30,450);
g.fillRect(360,0,30,450);
g.setColor(new Color(-8355712));
g.fillRect(50,0,50,150);
g.fillRect(25,150,100,150);
g.fillRect(0,300,150,150);
try {
Thread.sleep(1000);
} catch (InterruptedException e){};
try {
Thread.sleep(1000);
} catch (InterruptedException e){};
{
g.setColor(this.getBackground());
Rectangle r = getBounds();
g.fillRect(r.x,r.y,r.width,r.height);
}
g.setColor(new Color(-16777216));
g.fillRect(0,450,450,30);
g.setColor(new Color(-65536));
g.fillRect(60,0,30,450);
g.fillRect(210,0,30,450);
g.fillRect(360,0,30,450);
g.setColor(new Color(-8355712));
g.fillRect(350,300,50,150);
g.fillRect(25,150,100,150);
g.fillRect(0,300,150,150);
try {
Thread.sleep(1000);
} catch (InterruptedException e){};
try {
Thread.sleep(1000);
} catch (InterruptedException e){};
{
g.setColor(this.getBackground());
Rectangle r = getBounds();
g.fillRect(r.x,r.y,r.width,r.height);
}
g.setColor(new Color(-16777216));
g.fillRect(0,450,450,30);
g.setColor(new Color(-65536));
g.fillRect(60,0,30,450);
g.fillRect(210,0,30,450);
g.fillRect(360,0,30,450);
g.setColor(new Color(-8355712));
g.fillRect(350,300,50,150);
g.fillRect(175,300,100,150);
g.fillRect(0,300,150,150);
try {
Thread.sleep(1000);
} catch (InterruptedException e){};
try {
Thread.sleep(1000);
} catch (InterruptedException e){};
{
g.setColor(this.getBackground());
Rectangle r = getBounds();
g.fillRect(r.x,r.y,r.width,r.height);
}
g.setColor(new Color(-16777216));
g.fillRect(0,450,450,30);
g.setColor(new Color(-65536));
g.fillRect(60,0,30,450);
g.fillRect(210,0,30,450);
g.fillRect(360,0,30,450);
g.setColor(new Color(-8355712));
g.fillRect(200,150,50,150);
g.fillRect(175,300,100,150);
g.fillRect(0,300,150,150);
try {
Thread.sleep(1000);
} catch (InterruptedException e){};
try {
Thread.sleep(1000);
} catch (InterruptedException e){};
{
g.setColor(this.getBackground());
Rectangle r = getBounds();
g.fillRect(r.x,r.y,r.width,r.height);
}
g.setColor(new Color(-16777216));
g.fillRect(0,450,450,30);
g.setColor(new Color(-65536));
g.fillRect(60,0,30,450);
g.fillRect(210,0,30,450);
g.fillRect(360,0,30,450);
g.setColor(new Color(-8355712));
g.fillRect(200,150,50,150);
g.fillRect(175,300,100,150);
g.fillRect(300,300,150,150);
try {
Thread.sleep(1000);
} catch (InterruptedException e){};
try {
Thread.sleep(1000);
} catch (InterruptedException e){};
{
g.setColor(this.getBackground());
Rectangle r = getBounds();
g.fillRect(r.x,r.y,r.width,r.height);
}
g.setColor(new Color(-16777216));
g.fillRect(0,450,450,30);
g.setColor(new Color(-65536));
g.fillRect(60,0,30,450);
g.fillRect(210,0,30,450);
g.fillRect(360,0,30,450);
g.setColor(new Color(-8355712));
g.fillRect(50,300,50,150);
g.fillRect(175,300,100,150);
g.fillRect(300,300,150,150);
try {
Thread.sleep(1000);
} catch (InterruptedException e){};
try {
Thread.sleep(1000);
} catch (InterruptedException e){};
{
g.setColor(this.getBackground());
Rectangle r = getBounds();
g.fillRect(r.x,r.y,r.width,r.height);
}
g.setColor(new Color(-16777216));
g.fillRect(0,450,450,30);
g.setColor(new Color(-65536));
g.fillRect(60,0,30,450);
g.fillRect(210,0,30,450);
g.fillRect(360,0,30,450);
g.setColor(new Color(-8355712));
g.fillRect(50,300,50,150);
g.fillRect(325,150,100,150);
g.fillRect(300,300,150,150);
try {
Thread.sleep(1000);
} catch (InterruptedException e){};
try {
Thread.sleep(1000);
} catch (InterruptedException e){};
{
g.setColor(this.getBackground());
Rectangle r = getBounds();
g.fillRect(r.x,r.y,r.width,r.height);
}
g.setColor(new Color(-16777216));
g.fillRect(0,450,450,30);
g.setColor(new Color(-65536));
g.fillRect(60,0,30,450);
g.fillRect(210,0,30,450);
g.fillRect(360,0,30,450);
g.setColor(new Color(-8355712));
g.fillRect(350,0,50,150);
g.fillRect(325,150,100,150);
g.fillRect(300,300,150,150);
try {
Thread.sleep(1000);
} catch (InterruptedException e){};
{
g.setColor(this.getBackground());
Rectangle r = getBounds();
g.fillRect(r.x,r.y,r.width,r.height);
}
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -