当前位置:首页 > (完整版)基于Java的网络聊天工具的开发与实现毕业论文设计
String[] ie = ipEnd.split(\int[] ipsInt = new int[4]; int[] ipeInt = new int[4]; for (int i = 0; i < 4; i++) { }
progressBar.setIndeterminate(true); progressBar.setStringPainted(true);
DefaultListModel model = new DefaultListModel(); model.addElement(\搜索结果:\list.setModel(model); try {
for (int l = ipsInt[0]; l <= ipeInt[0]; l++) {
boolean b0 = l < ipeInt[0]; 记录第一层循环的条件 int k = l != ipsInt[0] ? 0 : ipsInt[1]; 从第二次循环以后kipsInt[i] = Integer.parseInt(is[i]); ipeInt[i] = Integer.parseInt(ie[i]);
赋值0
for (; b0 ? k < 256 : k <= ipeInt[1]; k++) {
boolean b1 = b0 || k < ipeInt[1]; 记录第二层循环的
条件
int j = k != ipsInt[1] ? 0 : ipsInt[2]; 从第二次循环后j
赋值0
for (; b1 ? j < 256 : j <= ipeInt[2]; j++) {
boolean b2 = b1 || b1 ? j < 256 : j < ipeInt[2]; int i = j != ipsInt[2] ? 0 : ipsInt[3];
}
for (; b2 ? i < 256 : i <= ipeInt[3]; i++) {
if(!button.isSelected()){ }
Thread.sleep(100);
String ip = l + \progressBar.setString(\正在搜索:\if (tree.addUser(ip, \
model.addElement(\添加\
+ ip + \
progressBar.setIndeterminate(false); return;
e.printStackTrace();
}finally{ }
progressBar.setIndeterminate(false); progressBar.setString(\搜索完毕\button.setText(\搜索新用户\button.setSelected(false);
searchUsers方法主要用于搜索局域网中的计算机用户。它首先先定义IP的搜索范围,设置组件的状态。然后定义搜索的方法,按照循环范围和循环条件进行搜索。 (2)添加好友页面如下:
图4.7 添加好友页面图
添加好友核心代码如下:
private class AddUserActionListener implements ActionListener {
public void actionPerformed(final ActionEvent e) {
String ip = JOptionPane.showInputDialog(MyQQ.this, \输入
新好友IP地址\
if (ip != null)
}
}
chatTree.addUser(ip, \
当用户选择“添加好友”菜单项后,先弹出输入对话框,提示用户输入新好友的IP地址,然后将好友信息添加到chatTree树组件中。 (3)删除好友页面如下:
图4.8 删除好友页面图
共分享92篇相关文档