📄 coloredboxes.java
字号:
//Copyright (c) 1998, Arthur Gittleman
//This example is provided WITHOUT ANY WARRANTY either expressed or implied.
// Debugging Exercise 11.8 -- Has Errors
public class ColoredBoxes extends Applet {
Color c;
boolean done;
public void start() {
done = false;
Thread t = new Thread(this);
t.start();
}
public void stop() {
done = true;
}
public void paint(Graphics g) {
g.drawRect(100,100,30,30);
}
public void run(){
while(! done) {
c = new Color((int)(255*Math.random()),
(int)(255*Math.random()),
(int)(255*Math.random()));
setForeground(c);
Thread.sleep(200);
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -