public String ti = \;
public String serverMessage =\;
public ServerFrame() {
// 服务器窗口
super(\聊天服务器\); setSize(550, 500);
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); setResizable(false); Dimension scr =
Toolkit.getDefaultToolkit().getScreenSize();// 在屏幕居中显示
// ==========服务器信息面板========================= pnlServer = new JPanel(); pnlServer.setLayout(null);
Dimension fra = this.getSize(); if (fra.width > scr.width) { }
if (fra.height > scr.height) { }
this.setLocation((scr.width - fra.width) / 2,
(scr.height - fra.height) / 2); fra.height = scr.height; fra.width = scr.width;
lblProtocol = new JLabel(\访问协议:\); txtProtocol = new JTextField(\, 10); txtProtocol.setEditable(false);
lblServerName = new JLabel(\服务器名称:\); txtServerName = new JTextField(10); txtServerName.setEditable(false);
lblMax = new JLabel(\最多在线人数:\); txtMax = new JTextField(\人\, 10); txtMax.setEditable(false);
lblNumber = new JLabel(\当前在线人数:\); txtNumber = new JTextField(\人\, 10); txtNumber.setEditable(false);
lblStatus = new JLabel(\当前状态:\); txtStatus = new JTextField(10); txtStatus.setEditable(false);
pnlServerInfo = new JPanel(new GridLayout(14, 1));
pnlServerInfo.setBorder(BorderFactory.createCompoundBorder(
BorderFactory.createTitledBorder(\), BorderFactory
.createEmptyBorder(1, 1, 1, 1)));
lblLog = new JLabel(\服务器日志]\); taLog = new TextArea(20, 50);
btnSaveLog = new JButton(\保存日志(S)\);
btnSaveLog.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent arg0) { }
saveLog();
btnStop = new JButton(\关闭服务器(C)\);
btnStop.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent arg0) { }
closeServer();
lblPort = new JLabel(\服务器端口:\); txtPort = new JTextField(\, 10); txtPort.setEditable(false);
lblIP = new JLabel(\服务器IP:\); txtIP = new JTextField(10); txtIP.setEditable(false);
});
});
pnlServerInfo.add(lblStatus); pnlServerInfo.add(txtStatus); pnlServerInfo.add(lblNumber); pnlServerInfo.add(txtNumber); pnlServerInfo.add(lblMax); pnlServerInfo.add(txtMax); pnlServerInfo.add(lblServerName); pnlServerInfo.add(txtServerName); pnlServerInfo.add(lblProtocol); pnlServerInfo.add(txtProtocol); pnlServerInfo.add(lblIP); pnlServerInfo.add(txtIP); pnlServerInfo.add(lblPort); pnlServerInfo.add(txtPort);
pnlServerInfo.setBounds(5, 5, 100, 400); lblLog.setBounds(110, 5, 100, 30); taLog.setBounds(110, 35, 400, 370); btnStop.setBounds(200, 410, 120, 30); btnSaveLog.setBounds(320, 410, 120, 30); pnlServer.add(pnlServerInfo); pnlServer.add(lblLog); pnlServer.add(taLog); pnlServer.add(btnStop); pnlServer.add(btnSaveLog);

