黑马程序员技术交流社区

标题: 模拟聊天系统的界面 [打印本页]

作者: 灰翔的河南银    时间: 2016-1-17 20:03
标题: 模拟聊天系统的界面
import java.awt.BorderLayout;
import java.awt.Button;
import java.awt.BorderLayout;
import java.awt.Button;
import java.awt.Frame;
import java.awt.Panel;
import java.awt.TextField;

public class Test_GUI  extends Frame{
        public Test_GUI(){
                init();
                southPanel();
                centerPanel();
        }
        public void centerPanel() {
                // TODO Auto-generated method stub
               
        }
        public void southPanel() {
                // TODO Auto-generated method stub
                Panel south = new Panel(); //创建panel
                //创建文本字段存储ip地址
                TextField tf = new TextField(15);
                Button send = new Button("发送");//发送按钮
                Button log = new Button("记录");//记录按钮
                Button clear = new Button("清除");//清屏
               
                Button shake = new Button("抖动");//振动按钮
               
                south.add(tf);
                south.add(send);
                south.add(log);
                south.add(clear);
                south.add(shake);
                this.add(south,BorderLayout.SOUTH);//将panel放在Fram的下面
        }
        public void init() {
                this.setLocation(500,50);
                this.setSize(400,600);
                this.setVisible(true);
        }
        public static void main(String[] args) {
                new Test_GUI();
                //System.out.println("nihao ");
        }
}







欢迎光临 黑马程序员技术交流社区 (http://bbs.itheima.com/) 黑马程序员IT技术论坛 X3.2