嘿,亲!知识可是无价之宝呢,但咱这精心整理的资料也耗费了不少心血呀。小小地破费一下,绝对物超所值哦!如有下载和支付问题,请联系我们QQ(微信同号):813200300
本次赞助数额为: 1 元微信扫码支付:1 元
请留下您的邮箱,我们将在2小时内将文件发到您的邮箱
界面完善的JAVA swing聊天室源码.数据库文件乱码的话可能是mysql数据库编码问题
/** 客户端入口类 */
public class ClientMain {
public static void main(String[] args) {
connection(); //连接到服务器
//设置外观感觉
JFrame.setDefaultLookAndFeelDecorated(true);
JDialog.setDefaultLookAndFeelDecorated(true);
try {
//UIManager.setLookAndFeel(UIManager.getCrossPlatformLookAndFeelClassName());
UIManager.setLookAndFeel(new SubstanceOfficeSilver2007LookAndFeel());
UIManager.setLookAndFeel(new SubstanceBusinessLookAndFeel());
} catch (Exception e) {
e.printStackTrace();
}
new LoginFrame(); //启动登录窗体
}
/** 连接到服务器 */
public static void connection() {
String ip = DataBuffer.configProp.getProperty("ip");
int port = Integer.parseInt(DataBuffer.configProp.getProperty("port"));
try {
DataBuffer.clientSeocket = new Socket(ip, port);
DataBuffer.oos = new ObjectOutputStream(DataBuffer.clientSeocket.getOutputStream());
DataBuffer.ois = new ObjectInputStream(DataBuffer.clientSeocket.getInputStream());
} catch (Exception e) {
JOptionPane.showMessageDialog(new JFrame(),
"连接服务器失败,请检查!","服务器未连上", JOptionPane.ERROR_MESSAGE);//否则连接失败
System.exit(0);
}
}
}