聊天窗口界面代码

合集下载
  1. 1、下载文档前请自行甄别文档内容的完整性,平台不提供额外的编辑、内容补充、找答案等附加服务。
  2. 2、"仅部分预览"的文档,不可在线预览部分如存在完整性等问题,可反馈申请退款(可完整预览的文档不适用该条件!)。
  3. 3、如文档侵犯您的权益,请联系客服反馈,我们会尽快为您处理(人工客服工作时间:9:00-18:30)。

聊天窗口界面代码
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
import javax.swing.plaf.basic.BasicBorders.RadioButtonBorder;
public class Jiecheng extends JApplet implements ActionListener
{
JButton Jvideo = new JButton("视频");
JButton Jsound = new JButton("语音");
JComboBox Jfile = new JComboBox();
JComboBox Jfunction1 = new JComboBox();
JComboBox Jfunction2 = new JComboBox();
JButton Jfont = new JButton("字体");
JButton Jfeel = new JButton("表情");
JButton Jcut = new JButton("截图");
JComboBox Jsend = new JComboBox();
JComboBox Jinformation = new JComboBox();
JButton Jimage = new JButton("图片");
JButton Jmusic = new JButton("音乐");
JButton Jdistance = new JButton("远程协助");
JButton Jclose= new JButton("关闭");
JTextArea t1=new JTextArea(15,40);
TextArea t2=new TextArea(6,61);
String file[]={"发送文件","发送文件夹","发送离线文件","发送文件设置"};
String function1[]={"更多功能","发送邮件","手机勉费聊QQ","搜索","电影专区","财付通","网购","游戏"};
String information[]={" 显示消息记录","显示比例","清屏","消息管理器"};
String send[]={"发送消息","按Enter发送","Ctrl+Enter 发送","消息合并","关闭窗口"};
JPanel p1,p2,p3,p4,p5,p6,p7,p8,p9;
public void init()
{
p1=new JPanel();
p2=new JPanel();
p3=new JPanel();
p4=new JPanel();
p5=new JPanel();
p6=new JPanel();
p7=new JPanel();
p8=new JPanel();
p9=new JPanel();
p1.add(Jvideo);
p1.add(Jsound);
p1.add(Jdistance);
for(int k=0;k<file.length;k++)
Jfile.addItem(file[k]);
p1.add(Jfile);
for(int a=0;a<function1.length;a++)
Jfunction1.addItem(function1[a]);
p1.add(Jfunction1);
p2.add(t1);
p3.setLayout(new BorderLayout());
p3.add(p1, BorderLayout.NORTH);
p3.add(p2, BorderLayout.CENTER);
add(p3);
p4.setLayout(new FlowLayout(FlowLayout.CENTER)); p4.add(Jfont);
p4.add(Jfeel);
p4.add(Jimage);
p4.add(Jmusic);
p4.add(Jcut);
for(int f=0;f<information.length;f++) Jinformation.addItem(information[f]);
p4.add(Jinformation);
p5.add(t2);
p6.setLayout(new FlowLayout(FlowLayout.RIGHT)); p6.add(Jclose);
for(int g=0;g<send.length;g++)
Jsend.addItem(send[g]);
p6.add(Jsend);
p7.setLayout(new BorderLayout());
p7.add(p5,BorderLayout.NORTH);
p7.add(p6,BorderLayout.CENTER);
add(p7);
p8.setLayout(new BorderLayout());
p8.add(p4,BorderLayout.NORTH);
p8.add(p7,BorderLayout.CENTER);
p9.setLayout(new BorderLayout());
p9.add(p3,BorderLayout.NORTH);
p9.add(p8,BorderLayout.CENTER);
add(p9);
}
public void actionPerformed(ActionEvent e)
{
}
public static void main(String []args)
{
JFrame f=new JFrame("用户聊天窗口");
f.addWindowFocusListener(new WindowAdapter() {
public void windowClosing(WindowEvent e)
{
System.exit(0);
}
});
Jiec
heng p=new Jiecheng(); p.init();
f.add("Center",p);
f.setSize(456,546);
f.show();
f.setResizable(false);
}
}。

相关文档
最新文档