[java]代码库
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package myframe;
import java.awt.BorderLayout;
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;
public class chatting_windows extends JFrame {
JTextArea textarea;
JPanel panel;
JComboBox xlk;
JTextField textfield;
JButton button;
JScrollPane gdt;
public chatting_windows(){
textarea=new JTextArea();
panel=new JPanel();
String[] choice={"悟空","八戒","师傅","沙僧","小白龙"};
xlk=new JComboBox(choice);
textfield=new JTextField(10);
button=new JButton("send");
gdt=new JScrollPane(textarea);
panel.add(xlk);
panel.add(textfield);
panel.add(button);
this.add(gdt);
this.add(panel,BorderLayout.SOUTH);
this.setTitle("聊天窗口");
this.setSize(400,300);
this.setIconImage((new ImageIcon("f://4.png")).getImage());
this.setLocation(400,320);
this.setResizable(false);
this.setDefaultCloseOperation(3);
this.setVisible(true);
}
public static void main(String[] args) {
JFrame frame=new chatting_windows();
}
}