📄 flowlayoutexample.java
字号:
import java.awt.event.*;
import java.awt.*;
public class FlowLayoutExample 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 FlowLayoutExample(String ss)
{
super(ss);
setLayout(new FlowLayout());
l3=new Label("系统登录界面");
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);
add(p5);
}
public static void main(String args[]) {
FlowLayoutExample nowFrame=new FlowLayoutExample("FlowLayoutExample");
nowFrame.addWindowListener(new WindowAdapter(){
public void windowClosing(WindowEvent e){
System.exit(0);
}
});
nowFrame.pack();
nowFrame.show();
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -