JAVA,
分享于 点击 26212 次 点评:95
JAVA,
好友聊天界面不重复出现问题
要在hmFriendChat1中里面查找有没有该对象,有的话不创建,没有就创建。FriendChat1 friendChat1=(FriendChat1)hmFriendChat1.get(userName+“to”+receiver);
if(friendChat1==null){
friendChat1=new FriendChat1(this.userName,receiver);
hmFriendChat1.put(userName+“to”+receiver,friendChat1);
}else{
friendChat1.setVisible(true);
}
激活好友在线图标
FriendList.Java
首先将好友图标设置成未激活状态
myfriendJLanel[i].setEnabled(false);未激活所有图标
然后激活自己
if(Integer.parseInt(userName)==i)
myfriendJLanel[i].setEnabled(true);
如何在已登录好友列表显示在线好友?
客户端向服务器发送获得在线好友信息的请求Message,服务器收到该请求发送在线好友信息,客户端接收到在线好友信息,激活对应好友图标。
相关文章
- 暂无相关文章
用户点评