?? backcolor.java
字號:
//==============================================================
// BackColor.java - AWT Applet using old inheritance event model
//
// Java學習源代碼檢索系統 Ver 1.0 20031015 免費正式版
// 版權所有: 中國IT認證實驗室(www.ChinaITLab.com)
// 程序制作: ChinaITLab網校教研中心
// 主頁地址: www.ChinaITLab.com 中國IT認證實驗室
// 論壇地址: bbs.chinaitlab.com
// 電子郵件: Java@ChinaITLab.com
//==============================================================
import java.applet.Applet;
import java.awt.*;
import java.util.Random;
public class BackColor extends Applet {
Random gen; // Random number generator for color selction
String buttonLabel = "Click Me!";
// Initialize applet
public void init() {
gen = new Random();
Button colorButton = new Button(buttonLabel);
add(colorButton); // Added to Applet container
}
// Respond to button click
public boolean action(Event evt, Object what) {
Color c;
if (buttonLabel.equals(what)) { // Is it our button?
do {
c = new Color(gen.nextInt());
} while (c == getBackground());
setBackground(c);
repaint();
}
return true; // Kill event
}
}
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -