网络聊天系统的界面

作者在 2010-05-18 15:57:29 发布以下内容

public static void main(String[] args) {
  Frame f = new Frame("客户端");
  Panel p1 = new Panel();
  Label l1 = new Label("地址");
  TextField t1 = new TextField(8);
  Label l2 = new Label("端口号");
  TextField t2 = new TextField(4);
  Label l3 = new Label("称呢");
  TextField t3 = new TextField(12);
  Button b1 = new Button("连接");
  p1.add(l1);
  p1.add(t1);
  p1.add(l2);
  p1.add(t2);
  p1.add(l3);
  p1.add(t3);
  p1.add(b1);
  Panel p2=new Panel();
  TextArea ta=new TextArea(11,60);
  ta.setEditable(false);
  ta.setBackground(Color.white);
  p2.add(ta);
  Panel p3=new Panel();
  Choice c=new Choice ();
  c.addItem("一号");
  c.addItem("二号");
  Label pl1 = new Label("发送给");
  TextField pt1=new TextField(8);
  TextField pt2=new TextField(15);
  Button pb1=new Button("发送文件");
  Button pb2=new Button("发送");
  p3.add(pl1);
  p3.add(c);
  p3.add(pt1);
  p3.add(pb1);
  p3.add(pt2);
  p3.add(pb2);
  f.add(p1,"North");
  f.add(p2,"Center");
  f.add(p3,"South");
  f.setSize(460, 300);
  f.addWindowListener(new WindowAdapter(){

   public void windowClosing(WindowEvent e) {
    System.exit(0);
   }
   
  });
  f.setVisible(true);

 }

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

public static void main(String[] args) {
  Frame f=new Frame("网络聊天系统");
  Panel p1=new Panel();
  Label l1=new Label("服务器端口");
  TextField t1=new TextField(20);
  Button b1=new Button("启动服务");
  Button b2=new Button("停止服务");
  p1.add(l1);
  p1.add(t1);
  p1.add(b1);
  p1.add(b2);
  Panel p2=new Panel();
  TextArea ta=new TextArea(19,50);
  ta.setEditable(false);
  ta.setBackground(Color.white);
  p2.add(ta);
  f.add(p1,"North");
  f.add(p2,"Center");
  f.setSize(400, 400);
  f.setResizable(false);
  f.setVisible(true);
  f.addWindowListener(new WindowAdapter(){

   public void windowClosing(WindowEvent e) {
    System.exit(0);
   }
   
  });
 }
   
 public void actionPerformed(ActionEvent e) {
  
  
 }

awt和Sring | 阅读 865 次
文章评论,共0条
游客请输入验证码
浏览275758次