?? testframewithpanel.java
字號:
import java.awt.*;
public class TestFrameWithPanel {
public static void main(String args[]) {
Frame f = new Frame("MyTest Frame");
f.setSize(300,200);
f.setLocation( 500, 400 );
f.setBackground(Color.blue);
Panel pan = new Panel();
pan.setSize(150,100);
pan.setLocation( 50, 50 );
pan.setBackground(Color.green);
Button b = new Button("ok");
b.setSize( 80,20 );
b.setLocation( 50,50 );
b.setBackground(Color.red);
f.setLayout(null); // 取消默認(rèn)布局管理器
pan.setLayout( null );
pan.add(b); // 面板上加入按鈕
f.add(pan); // 窗體上加入面板
f.setVisible(true);
}
}
?? 快捷鍵說明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -