📄 qqserverappframe.java
字号:
package com.softfz.jn0708.main;
import java.awt.Color;
import java.awt.Container;
import java.awt.event.WindowAdapter;
import java.awt.event.WindowEvent;
import java.io.IOException;
import java.net.ServerSocket;
import java.util.HashSet;
import java.util.Set;
import javax.swing.JFrame;
import javax.swing.JOptionPane;
import javax.swing.JTabbedPane;
import com.softfz.jn0708.config.ConfigPanel;
import com.softfz.jn0708.main.department.DeptPanel;
import com.softfz.jn0708.main.log.LogPanel;
import com.softfz.jn0708.main.manager.ManagerPanel;
import com.softfz.jn0708.main.user.UserPanel;
import com.softfz.jn0708.util.Tools;
/**
* QQ聊天主窗体框架设计实现
*/
public class QQServerAppFrame extends JFrame{
private static final long serialVersionUID = -5529834019059576959L;
private UserPanel jplUser;
private DeptPanel jplDepart;
private ManagerPanel jplManager;
private LogPanel logpanel ;
private ConfigPanel config ;
private JTabbedPane tabbedPane;
private ServerSocket server ;
private Set totalThread = new HashSet();
/**
* 聊天窗体构造函数
*
*/
public QQServerAppFrame(){
super("服务器管理");
try {
server = new ServerSocket(Integer.parseInt(Tools.properties.get("ServerPort").toString()));
Container c =this.getContentPane();
jplUser = new UserPanel(this);//用户面板
jplUser.setBackground(new Color(241,250,255));
jplDepart = new DeptPanel(this);//部门面板
jplDepart.setBackground(new Color(241,250,255));
jplManager = new ManagerPanel(this,server,totalThread);//服务器管理
jplManager.setBackground(new Color(241,250,255));
logpanel = new LogPanel();//日志管理
logpanel.setBackground(new Color(241,250,255));
config = new ConfigPanel();//服务器配置管理
config.setBackground(new Color(241,250,255));
tabbedPane=new JTabbedPane();// 定义JTabbedPane ,换页面板
tabbedPane.setTabPlacement(JTabbedPane.TOP);//设置标签置放位置。
tabbedPane.setBackground(new Color(241,250,255));
tabbedPane.addTab("在线管理",jplManager);
tabbedPane.addTab("用户管理",jplUser);
tabbedPane.addTab("部门管理",jplDepart);
tabbedPane.addTab("配置管理",config);
tabbedPane.addTab("日志管理",logpanel);
c.add(tabbedPane);
this.setSize(585,440);
this.setLocation(300,150);
this.setVisible(true);
this.addWindowListener(new WindowAdapter(){
public void windowClosing(WindowEvent e) {
jplManager.getMymanlistener().stopServer();
System.exit(0);
}
});
} catch (NumberFormatException e2) {
// TODO 自动生成 catch 块
// e2.printStackTrace();
JOptionPane.showMessageDialog(null, "端口被使用或是服务器已打开!", "提示",JOptionPane.INFORMATION_MESSAGE);
System.exit(0);
} catch (IOException e2) {
// TODO 自动生成 catch 块
JOptionPane.showMessageDialog(null, "端口被使用或是服务器已打开!", "提示",JOptionPane.INFORMATION_MESSAGE);
System.exit(0);
// e2.printStackTrace();
}
}
/**
* 获取日志管理面板
* @return
*/
public LogPanel getLogpanel() {
return logpanel;
}
public ConfigPanel getConfig() {
return config;
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -