[Java] 聊天界面 →→→→→进入此内容的聊天室

来自 , 2019-08-07, 写在 Java, 查看 124 次.
URL http://www.code666.cn/view/8597a6cf
  1. /*
  2.  * To change this license header, choose License Headers in Project Properties.
  3.  * To change this template file, choose Tools | Templates
  4.  * and open the template in the editor.
  5.  */
  6.  
  7. package myframe;
  8.  
  9. import java.awt.BorderLayout;
  10. import javax.swing.ImageIcon;
  11. import javax.swing.JButton;
  12. import javax.swing.JComboBox;
  13. import javax.swing.JFrame;
  14. import javax.swing.JPanel;
  15. import javax.swing.JScrollPane;
  16. import javax.swing.JTextArea;
  17. import javax.swing.JTextField;
  18.  
  19. public class chatting_windows extends JFrame {
  20.     JTextArea textarea;
  21.     JPanel panel;
  22.     JComboBox xlk;
  23.     JTextField textfield;
  24.     JButton button;
  25.     JScrollPane gdt;
  26.     public chatting_windows(){
  27.     textarea=new JTextArea();
  28.     panel=new JPanel();
  29.     String[] choice={"悟空","八戒","师傅","沙僧","小白龙"};
  30.     xlk=new JComboBox(choice);
  31.     textfield=new JTextField(10);
  32.     button=new JButton("send");
  33.     gdt=new JScrollPane(textarea);
  34.    
  35.     panel.add(xlk);
  36.     panel.add(textfield);
  37.     panel.add(button);
  38.    
  39.     this.add(gdt);
  40.     this.add(panel,BorderLayout.SOUTH);
  41.    
  42.     this.setTitle("聊天窗口");
  43.     this.setSize(400,300);
  44.     this.setIconImage((new ImageIcon("f://4.png")).getImage());
  45.     this.setLocation(400,320);
  46.     this.setResizable(false);
  47.    
  48.     this.setDefaultCloseOperation(3);
  49.     this.setVisible(true);
  50. }
  51.     public static void main(String[] args) {
  52.         JFrame frame=new chatting_windows();
  53.     }
  54. }
  55.  

回复 "聊天界面"

这儿你可以回复上面这条便签

captcha