ThinkChat2.0新版上线,更智能更精彩,支持会话、画图、阅读、搜索等,送10W Token,即刻开启你的AI之旅 广告
~~~ package gui.b1; import java.awt.*; import javax.swing.*; //聊天窗口 public class Test extends JFrame{ JTextArea wby;//文本域 JPanel mb;//面板 JComboBox xlk;//下拉框 JButton an;//按钮 JTextField wbk; //文本框 JScrollPane gd;//滚动 public static void main(String[] args) { Test lx=new Test(); } public Test(){ wby=new JTextArea(); mb=new JPanel(); String[] lt={"悟空","八戒","沙僧","小白龙"}; xlk=new JComboBox(lt); wbk=new JTextField(10); an=new JButton("发送"); gd=new JScrollPane(wby); mb.add(xlk); mb.add(wbk); mb.add(an); this.add(gd); this.add(mb,BorderLayout.SOUTH); this.setTitle("聊天窗口"); this.setSize(300,200); this.setIconImage((new ImageIcon("image/test.jpg")).getImage()); this.setLocation(300,280); this.setResizable(false); this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); this.setVisible(true); } } ~~~ ![](https://box.kancloud.cn/91ecfaedd0f1c2cd40e0980df4c1a479_333x224.png)