GUI程序设计

来源:互联网 发布:js只允许输入数字 编辑:程序博客网 时间:2024/05/07 04:08
import java.awt.*;
public class Test
{
 public static void main(String[] args)
{
 Frame f=new Frame("登陆界面");
 f.setBackground(Color.blue);
 f.setLayout(new FlowLayout());
 Label c1=new Label("请输入您的用户信息:");
 Label l1=new Label("用户名");
 TextField b1=new TextField(20);
 Label l2=new Label("密码");
 TextField b2=new TextField(20);
 b2.setEchoChar('*');
 l1.setFont(new Font("楷体_gb2312",Font.BOLD+Font.ITALIC,15));
 l2.setFont(new Font("楷体_gb2312",Font.BOLD+Font.ITALIC,15));
 Button a1=new Button("确定");
 Button a2=new Button("重置");
 f.add(c1);
 f.add(l1);
 f.add(b1);
 f.add(l2);
 f.add(b2);
 f.add(a1);
 f.add(a2);
 f.setSize(200,250);
 f.setVisible(true);
  }
 }
原创粉丝点击