while (sc.hasNextLine()) {
placardStr.append(sc.nextLine());
}
pushMessage(placardStr.toString());
}
} catch (FileNotFoundException e) {
pushMessage("公告路径错误,或公告文件不存在");
}
}
//----------------------------------------------------------------------------------
public void setStatic(String str){// 设置状态栏信息
if(stateLabel != null){
stateLabel.setText(str);
}
}
public void pushMessage(String info){// 堆压信息
if(!messageStack.contains(info)){
messageStack.push(info);
}
}
private void showMessageDialog(String message){
JOptionPane.showMessageDialog(this, message);
}
//----------------------------------------------------------------------------------
private String showInputDialog(String str){// 显示输入对话框
String newName = JOptionPane.showInputDialog(this,
"输入" + str + "的新名字");
return newName;
}
private class accessFolderActionListener implements ActionListener {// 访问资源
public void actionPerformed(final ActionEvent e) {
TreePath path = chatTree.getSelectionPath();
if (path == null)
return;
DefaultMutableTreeNode node = (DefaultMutableTreeNode) path
.getLastPathComponent();
User user = (User) node.getUserObject();
String ip = "\\\\"+user.getIp();
String command = e.getActionCommand();
if (command.equals("computer")) {
Resource.startFolder(ip);
}
if (command.equals("public")) {
String serverPaeh = preferences.get("pubPath", null);
if (serverPaeh == null) {
pushMessage("未设置公共程序路径");
return;
}
Resource.startFolder(serverPaeh);
}
}
}
private class RenameActionListener implements ActionListener {// 更名
public void actionPerformed(final ActionEvent e) {
TreePath path = chatTree.getSelectionPath();
if (path == null)
return;
DefaultMutableTreeNode node = (DefaultMutableTreeNode) path
.getLastPathComponent();
User user = (User) node.getUserObject();
String newName = showInputDialog(user.getName());
if (newName != null && !newName.isEmpty()) {
user.setName(newName);
dao.updateUser(user);
DefaultTreeModel model = (DefaultTreeModel) chatTree.getModel();
model.reload();
chatTree.setSelectionPath(path);
initUserInfoButton();
}
}
}
private class FrameWindowListener extends WindowAdapter {
public void windowClosing(final WindowEvent e) {// 系统关闭事件
setVisible(false);
}
}
private class AddUserActionListener implements ActionListener {
public void actionPerformed(final ActionEvent e