import java.awt.*;
import javax.swing.*;
public class Test extends JFrame{//把需要的组件全部在这里定义
JTextArea wby;//文本域
JPanel mb;
JComboBox xlk;//下拉框
JButton an;
JTextField wbk;//文本框
JScrollPane gd;
public static void main(String[] args){
Test lx=new Test();
}
public Test(){
wby=new JTextArea();
mb=new JPanel();
String[] lt={"悟空","八戒","沙僧","小白龙"};
xlk=new JComboBox(lt);
wbk=new JTextField(10);
an=new JButton("发送");
gd=new JScrollPane(wby);
mb.add(xlk);mb.add(wbk);mb.add(an);
this.add(gd);this.add(mb,BorderLayout.SOUTH);
this.setTitle("聊天窗口");
this.setSize(500,300);
this.setIconImage((new ImageIcon("image/qq.jpg")).getImage());//左上角标签栏添加小图标
this.setLocation(300,280);
this.setResizable(false);
this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
this.setVisible(true);
}
}
聊天窗口
猜你喜欢
转载自blog.csdn.net/WYJ____/article/details/82526468
今日推荐
周排行