星空网 > 软件开发 > Java

Java之JScrollPane:打造一个QQ好友聊天窗口

程序代码:

package com.os.frame;import java.awt.BorderLayout;import java.awt.FlowLayout;import java.awt.event.ActionEvent;import java.awt.event.ActionListener;import javax.swing.ImageIcon;import javax.swing.JButton;import javax.swing.JComboBox;import javax.swing.JFrame;import javax.swing.JPanel;import javax.swing.JScrollPane;import javax.swing.JTextArea;import javax.swing.JTextField;/** * * @author RenHongWei */public class MainFrame extends JFrame {  public static void main(String[] args) {    new MainFrame("QQ");  }  JPanel jp = null;  JTextArea jta = null;  JTextField jtf = null;  JScrollPane jsp = null;  JComboBox jcb = null;  JButton jb = null;  public MainFrame(String title) {    super(title);    initComponent();    initFrame();    initLayout();  }  private void initLayout() {    this.setLayout(new BorderLayout());    this.add(jsp);    this.add(jp, BorderLayout.SOUTH);  }  private void initFrame() {    this.setSize(500, 300);    this.setLocation(200, 200);    this.setIconImage(new ImageIcon("images/Penguins.jpg").getImage());    this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);    this.setVisible(true);  }  private void initComponent() {    jta = new JTextArea();    jsp = new JScrollPane(jta);    jp = new JPanel();    String[] chatter = { "Boy", "Lady" };    jcb = new JComboBox(chatter);    jtf = new JTextField(10);    jb = new JButton("Send");    jp.add(jcb);    jp.add(jtf);    jp.add(jb);  }}

调试界面:

Java之JScrollPane:打造一个QQ好友聊天窗口

 




原标题:Java之JScrollPane:打造一个QQ好友聊天窗口

关键词:JS

JS
*特别声明:以上内容来自于网络收集,著作权属原作者所有,如有侵权,请联系我们: admin#shaoqun.com (#换成@)。

多边贸易:https://www.goluckyvip.com/tag/30855.html
多变体:https://www.goluckyvip.com/tag/30856.html
多变体广告:https://www.goluckyvip.com/tag/30857.html
多点Dmall:https://www.goluckyvip.com/tag/30858.html
多伦多海外仓:https://www.goluckyvip.com/tag/30859.html
韩国疫情反复:https://www.goluckyvip.com/tag/3086.html
桂林酒店销售多少钱 桂林旅游宾馆价格:https://www.vstour.cn/a/410227.html
十里银滩旅游攻略玩什么住哪里怎么去?:https://www.vstour.cn/a/410228.html
相关文章
我的浏览记录
最新相关资讯
海外公司注册 | 跨境电商服务平台 | 深圳旅行社 | 东南亚物流