网络聊天室课程设计报告(内附java代码)

2026/1/22 15:12:45

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);


网络聊天室课程设计报告(内附java代码).doc 将本文的Word文档下载到电脑
搜索更多关于: 网络聊天室课程设计报告(内附java代码) 的文档
相关推荐
相关阅读
× 游客快捷下载通道(下载后可以自由复制和排版)

下载本文档需要支付 10

支付方式:

开通VIP包月会员 特价:29元/月

注:下载文档有可能“只有目录或者内容不全”等情况,请下载之前注意辨别,如果您已付费且无法下载或内容有问题,请联系我们协助你处理。
微信:xuecool-com QQ:370150219