package jiguang;
import javax.swing.*;
import java.awt.*;
import java.awt.event.*;
import java.sql.*;
import java.net.*;
import javax.swing.border.*;
import javax.swing.tree.*;
import com.borland.jbcl.layout.*;
import java.util.List;
import java.util.ArrayList;
import java.net.*;
import java.io.*;
import com.borland.dbswing.JdbTextArea;
import com.borland.dbswing.TableScrollPane;
import java.util.Date;
/**
* <p>Title: </p>
* <p>Description: </p>
* <p>Copyright: Copyright (c) 2004</p>
* <p>Company: </p>
* @author not attributable
* @version 1.0
*/
public class ZhuFrame
extends JFrame {
int port;
String ipAddress;
String userPort;
String userState;
JPanel contentPane;
JToolBar jToolBar = new JToolBar();
JButton jButton2 = new JButton();
JButton jButton3 = new JButton();
ImageIcon image1;
ImageIcon image2;
ImageIcon image3;
ImageIcon image4;
ImageIcon image5;
ImageIcon image6;
ImageIcon image7;
ImageIcon image8;
BorderLayout borderLayout1 = new BorderLayout();
String serverName;
String localIP;
Statement stm;
Connection conn;
Statement stmR;
Connection connR;
TitledBorder titledBorder1;
TitledBorder titledBorder2;
JTree jTree1;
GouZaoJTree gouZaoJTree;
JPanel jPanel2 = new JPanel();
BorderLayout borderLayout2 = new BorderLayout();
JPanel jPanel1 = new JPanel();
JTextField jTextField1 = new JTextField();
BorderLayout borderLayout3 = new BorderLayout();
JPanel jPanel3 = new JPanel();
TitledBorder titledBorder3;
TitledBorder titledBorder4;
JScrollPane jsp1 = null;
JPanel jPanel4 = new JPanel();
FlowLayout flowLayout1 = new FlowLayout();
JButton jButton7 = new JButton();
JButton jButton8 = new JButton();
Border border1;
Border border2;
Border border3;
Border border4;
Border border5;
JPanel jPanel5 = new JPanel();
JButton jButton4 = new JButton();
BorderLayout borderLayout4 = new BorderLayout();
JPanel jPanel6 = new JPanel();
JComboBox jComboBox1 = new JComboBox();
FlowLayout flowLayout2 = new FlowLayout();
JTextArea jTextArea2 = new JTextArea();
List list=new ArrayList(); //选择的对象
List listZu = new ArrayList(); //部门中的组
List listIP = new ArrayList(); //放即将发送人的IP
List listPort = new ArrayList(); //放即将发送人的Port
List listState = new ArrayList(); //放即将发送人的State
List listFrame = new ArrayList(); //放小窗口
String searchIPPortState;
public static String user; //存放本地用户名
BufferedReader in;
PrintWriter out;
ServerSocket server;
Socket socket;
Socket socketl;
JButton jButton10 = new JButton();
String selectZu;
String buMenName;
String zhiYuanName;
JdbTextArea jdbTextArea1 = new JdbTextArea();
TableScrollPane tsp = new TableScrollPane(jdbTextArea1);
JButton jButton9 = new JButton();
boolean flag6=false;
ZiLiao ziliao;
ZiLiaoXiuGai ziLiaoXiuGai;
JiShiJiLu jiShiJiLu;
boolean jingli=false;
//Construct the frame
public ZhuFrame(){
}
public ZhuFrame(String serverName, Statement stm, Connection conn,
Statement stmR, Connection connR, String localIP,
String userName, int port) {
enableEvents(AWTEvent.WINDOW_EVENT_MASK);
this.serverName = serverName;
this.stm = stm;
this.conn = conn;
this.stmR = stmR;
this.connR = connR;
this.localIP = localIP;
user = userName.replaceAll(" ", "");
this.port = port;
new ServerThread().start();
try {
jbInit();
}
catch (Exception e) {
e.printStackTrace();
}
new SelectXinXiRecord().start();
}
class SelectXinXiRecord extends Thread{
public void run(){
String searchXinXi = "select * from XinXi where XinXiDuiXiang='" + user + "'";
String deleteXinXi = "delete from XinXi where XinXiDuiXiang='" + user + "'";
try {
ResultSet r7 = stmR.executeQuery(searchXinXi);
while (r7.next()) {
String userr=r7.getString("UserName");
String xinXiJiaoHu=r7.getString("XinXiJiaoHu");
String xinXiRecord = r7.getString("XinXiRecord");
String xinXiTime = r7.getString("XinXiTime");
xinXiRecord = xinXiRecord.replaceAll(" ", "");
xinXiTime = xinXiTime.replaceAll(" ", "");
xinXiJiaoHu=xinXiJiaoHu.replaceAll(" ","");
jdbTextArea1.append(xinXiTime + "\n"+xinXiJiaoHu+xinXiRecord + "\n");
jdbTextArea1.append(
"--------------------------------------------------------------------\n");
String updateMyUser = "update " + user +
" set XinXiState=0 where XinXiState=1 and XinXiDuiXiang='" +
userr + "'";
String insertMyUser = "insert into " + user + " values('" + userr + "','" +
xinXiJiaoHu + "','" +xinXiRecord+"','"+xinXiTime+"','1')";
stm.executeUpdate(updateMyUser);
stm.executeUpdate(insertMyUser);
}
stmR.executeUpdate(deleteXinXi);
}
catch (SQLException ex) {
ex.printStackTrace();
}
}
}
//Component initialization
private void jbInit() throws Exception {
image1 = new ImageIcon(jiguang.ZhuFrame.class.getResource("xiugai.gif"));
image2 = new ImageIcon(jiguang.ZhuFrame.class.getResource("Logger.gif"));
image3 = new ImageIcon(jiguang.ZhuFrame.class.getResource("help.png"));
image4 = new ImageIcon(jiguang.ZhuFrame.class.getResource("message.gif"));
image5 = new ImageIcon(jiguang.ZhuFrame.class.getResource("Refresh.gif"));
image6 = new ImageIcon(jiguang.ZhuFrame.class.getResource("repare.gif"));
image7= new ImageIcon(jiguang.ZhuFrame.class.getResource("tuichu.png"));
image8= new ImageIcon(jiguang.ZhuFrame.class.getResource("xiugaimi.png"));
gouZaoJTree = new GouZaoJTree(stmR, connR);
jTree1 = gouZaoJTree.jbInit();
jsp1 = new JScrollPane(jTree1, JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED,
JScrollPane.HORIZONTAL_SCROLLBAR_NEVER);
contentPane = (JPanel)this.getContentPane();
titledBorder1 = new TitledBorder("");
titledBorder2 = new TitledBorder("");
titledBorder3 = new TitledBorder("");
titledBorder4 = new TitledBorder("");
border1 = BorderFactory.createBevelBorder(BevelBorder.RAISED, Color.white,
new Color(214, 255, 255),
new Color(73, 93, 124),
new Color(105, 133, 178));
border2 = BorderFactory.createCompoundBorder(BorderFactory.
createBevelBorder(BevelBorder.
RAISED, Color.white, new Color(214, 255, 255), new Color(73, 93, 124),
new Color(105, 133, 178)), BorderFactory.createEmptyBorder(0, 5, 0, 5));
border4 = BorderFactory.createCompoundBorder(BorderFactory.
createBevelBorder(BevelBorder.
RAISED, Color.white, Color.white, new Color(103, 101, 98),
new Color(148, 145, 140)),
BorderFactory.
createEmptyBorder(0, 5, 0, 5));
border5 = BorderFactory.createBevelBorder(BevelBorder.RAISED, Color.white,
Color.white,
new Color(124, 124, 124),
new Color(178, 178, 178));
titledBorder5 = new TitledBorder("");
border6 = BorderFactory.createCompoundBorder(BorderFactory.createEtchedBorder(Color.white,new Color(148, 145, 140)),BorderFactory.createEmptyBorder(0,1,0,1));
border7 = BorderFactory.createCompoundBorder(new EtchedBorder(EtchedBorder.RAISED,Color.white,new Color(148, 145, 140)),BorderFactory.createEmptyBorder(0,1,0,1));
border8 = new EtchedBorder(EtchedBorder.RAISED,Color.white,new Color(148, 145, 140));
contentPane.setLayout(bord