用java 语言编一个聊天小程序 要求: 使用图形用户界面
能实现一个聊天室中多人聊天
可以两人私聊
提示:使用socket 通信 import java
*; import java
*; import javax
*; import java
*; import java
*; public class test { public static void main(String[] args) { EventQueue
invokeLater(new Runnable() { public void run() { DrawFrame frame = new DrawFrame(); frame
setDefaultCloseOperation(JFrame
EXIT_ON_CLOSE); frame
setVisible(true); } }); } } class DrawFrame extends JFrame { public DrawFrame() { setLocation(100,100); setTitle("我的 QQ"); setSize(DEFAULT_WIDTH,DEFAULT_HEIGHT); //添加菜单项…… JMenuBar menuBar = new JMenuBar(); setJMenuBar(menuBar); JMenu edit = new JMenu("菜单"); menuBar
add(edit); JMenuItem sset = new JMenuItem("设置"); JMenuItem eexit = new JMenuItem("退出"); edit
add(sset); edit
addSeparator(); edit
add(eexit); fin