zoukankan      html  css  js  c++  java
  • gui编程实战——qq聊天界面1

     1 public class testDemo_2 extends JFrame{
     2     JTextArea jta=null;                       //多行文本框组件
     3     JScrollPane jsp=null;                     //滚动文本框
     4     JPanel jp1=null;
     5     JComboBox jcb=null;                       //下拉文本框
     6     JTextField jtf=null;
     7     JButton jb1=null;
     8     public static void main(String[] args){
     9         testDemo_2 demo=new testDemo_2();
    10     }
    11     
    12     //构造函数
    13     public testDemo_2(){
    14         jta=new JTextArea();
    15         jsp=new JScrollPane(jta);
    16         jp1=new JPanel();
    17         String []chatter={"布什","拉登"};
    18         jcb=new JComboBox(chatter);
    19         jtf=new JTextField(10);
    20         jb1=new JButton("发送");
    21         
    22         //设置布局
    23         //添加组件
    24         jp1.add(jcb);
    25         jp1.add(jtf);
    26         jp1.add(jb1);
    27         //加入JFrame
    28         this.add(jsp);
    29         this.add(jp1,BorderLayout.SOUTH);
    30         //属性
    31         this.setSize(300,200);
    32         this.setTitle("腾讯qq");
    33         this.setIconImage((new ImageIcon("image/qq.jpg")).getImage());
    34         this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    35         
    36         this.setVisible(true);
    37     }
    38 }

    运行效果如下:

  • 相关阅读:
    功能测试
    数据库
    loadrunner
    笔记
    基础知识
    类方法, 实例方法, 静态方法
    统计英文单词次数
    合并文件内容
    字典排序
    排序算法
  • 原文地址:https://www.cnblogs.com/cxq1126/p/7279565.html
Copyright © 2011-2022 走看看