?? gridlayoutexample.java
字號:
import java.awt.event.*;
import java.awt.*;
public class GridLayoutExample extends Frame {
Label l1,l2,l3;
Button b1=new Button("登錄");
Button b2=new Button("重置");
TextField txt1,txt2;
TextArea txt3;
Panel p1,p2,p3,p4,p5;
public GridLayoutExample(String ss)
{
super(ss);
setLayout(new GridLayout(3,3));
l3=new Label("系統(tǒng)登錄界面");
p1=new Panel();
p1.add(l3);
Label l1=new Label("用戶名:");
txt1=new TextField(5);
p2=new Panel();
p2.setLayout(new FlowLayout());
p2.add(l1);
p2.add(txt1);
Label l2=new Label("密碼 :");
txt2=new TextField(8);
txt2.setEchoChar('*');
p3=new Panel();
p3.add(l2);
p3.add(txt2);
txt3=new TextArea();
txt3.setText("這里一個登錄界面......"+"\n");
txt3.setRows(5);
txt3.setColumns(18);
txt3.append("這里一個登錄界面......"+"\n");
txt3.insert("這里一個登錄界面......"+"\n",2);
txt3.setEditable(false);
p4=new Panel();
p4.add(txt3);
p5=new Panel();
p5.add(b1);
p5.add(b2);
add(p1);
add(p2);
add(p3);
add(p4,1);
add(p5);
}
public static void main(String args[]) {
GridLayoutExample nowFrame=new GridLayoutExample("GridLayoutExample");
nowFrame.addWindowListener(new WindowAdapter(){
public void windowClosing(WindowEvent e){
System.exit(0);
}
});
nowFrame.pack();
nowFrame.show();
}
}
?? 快捷鍵說明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -