77范文网 - 专业文章范例文档资料分享平台

Java聊天室毕业论文(6)

来源:网络收集 时间:2019-04-23 下载这篇文档 手机版
说明:文章内容仅供预览,部分内容可能不全,需要完整文档或者需要复制内容,请下载word后使用。下载word有问题请添加微信号:或QQ: 处理(尽可能给您提供完整文档),感谢您的支持与谅解。点击这里给我发消息

河南理工大学本科生毕业设计(论文)说明书

toolBar.add(stopServer); toolBar.addSeparator(); toolBar.add(exitButton);

contentPane.add(toolBar,BorderLayout.NORTH); stopServer.setEnabled(false); stopItem.setEnabled(false); portItem.addActionListener(this); startItem.addActionListener(this); stopItem.addActionListener(this); exitItem.addActionListener(this); helpItem.addActionListener(this); portSet.addActionListener(this); startServer.addActionListener(this); stopServer.addActionListener(this); exitButton.addActionListener(this); combobox=new JComboBox(); combobox.insertItemAt(\所有人\ combobox.setSelectedIndex(0); messageShow=new JTextArea(); messageShow.setEditable(false); messageScrollPane=new

JScrollPane(messageShow,JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED,JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED); messageScrollPane.setPreferredSize(new Dimension(400,400)); messageScrollPane.revalidate(); showStatus=new JTextField(35); showStatus.setEditable(false);

21

河南理工大学本科生毕业设计(论文)说明书

sysMessage=new JTextField(23); sysMessage.setEnabled(false); sysMessageButton=new JButton(); sysMessageButton.setText(\发送\ sysMessage.addActionListener(this); sysMessageButton.addActionListener(this); sendToLabel=new JLabel(\发送至:\ messageLabel=new JLabel(\发送消息:\ downPanel=new JPanel(); gridBag=new GridBagLayout(); downPanel.setLayout(gridBag); gridBagCon=new GridBagConstraints(); gridBagCon.gridx=0; gridBagCon.gridy=0; gridBagCon.gridwidth=3; gridBagCon.gridheight=2; gridBagCon.ipadx=5; gridBagCon.ipady=5;

JLabel none=new JLabel(\ \ gridBag.setConstraints(none,gridBagCon); downPanel.add(none);

gridBagCon=new GridBagConstraints(); gridBagCon.gridx=0; gridBagCon.gridy=2;

gridBagCon.insets=new Insets(1,0,0,0); gridBagCon.ipadx=5; gridBagCon.ipady=5;

22

河南理工大学本科生毕业设计(论文)说明书

gridBag.setConstraints(sendToLabel,gridBagCon); downPanel.add(sendToLabel);

gridBagCon=new GridBagConstraints(); gridBagCon.gridx=1; gridBagCon.gridy=2;

gridBagCon.anchor=GridBagConstraints.LINE_START; gridBag.setConstraints(combobox,gridBagCon); downPanel.add(combobox);

gridBagCon=new GridBagConstraints(); gridBagCon.gridx=0; gridBagCon.gridy=3;

gridBag.setConstraints(messageLabel,gridBagCon); downPanel.add(messageLabel); gridBagCon=new GridBagConstraints(); gridBagCon.gridx=1; gridBagCon.gridy=3;

gridBag.setConstraints(sysMessage,gridBagCon); downPanel.add(sysMessage);

gridBagCon=new GridBagConstraints(); gridBagCon.gridx=2; gridBagCon.gridy=3;

gridBag.setConstraints(sysMessageButton,gridBagCon); downPanel.add(sysMessageButton); gridBagCon=new GridBagConstraints(); gridBagCon.gridx=0; gridBagCon.gridy=4; gridBagCon.gridwidth=3;

23

河南理工大学本科生毕业设计(论文)说明书

gridBag.setConstraints(showStatus,gridBagCon); downPanel.add(showStatus);

contentPane.add(messageScrollPane,BorderLayout.CENTER); contentPane.add(downPanel,BorderLayout.SOUTH); this.addWindowListener( new WindowAdapter(){

public void windowClosing(WindowEvent e){ stopService(); System.exit(0); } } ); } /**

* 事件处理 */

public void actionPerformed(ActionEvent e) { Object obj=e.getSource();

if (obj==startServer || obj==startItem) { startService(); }

else if(obj==stopServer || obj==stopItem) {

int j=JOptionPane.showConfirmDialog(this,\真的停止服务吗?\停止服务\ if(j==JOptionPane.YES_OPTION) { stopService(); }

24

河南理工大学本科生毕业设计(论文)说明书

}

else if(obj==portSet||obj==portItem) { PortConf portConf=new PortConf(this); //portConf.show(); portConf.setVisible(true); }

else if (obj==exitButton||obj==exitItem) {

int j=JOptionPane.showConfirmDialog(this,\真的要退出吗?\退出\ if(j==JOptionPane.YES_OPTION) { stopService(); System.exit(0); } }

else if(obj==helpItem){

Help helpDialog=new Help(this); helpDialog.setVisible(true); }

else if (obj==sysMessage || obj==sysMessageButton){ sendSystemMessage(); } }

public void startService(){ try{

serverSocket=new ServerSocket(port,10);

messageShow.append(\服务端已经启动,在\端口侦听...\\n\

startServer.setEnabled(false);

25

百度搜索“77cn”或“免费范文网”即可找到本站免费阅读全部范文。收藏本站方便下次阅读,免费范文网,提供经典小说综合文库Java聊天室毕业论文(6)在线全文阅读。

Java聊天室毕业论文(6).doc 将本文的Word文档下载到电脑,方便复制、编辑、收藏和打印 下载失败或者文档不完整,请联系客服人员解决!
本文链接:https://www.77cn.com.cn/wenku/zonghe/622874.html(转载请注明文章来源)
Copyright © 2008-2022 免费范文网 版权所有
声明 :本网站尊重并保护知识产权,根据《信息网络传播权保护条例》,如果我们转载的作品侵犯了您的权利,请在一个月内通知我们,我们会及时删除。
客服QQ: 邮箱:tiandhx2@hotmail.com
苏ICP备16052595号-18
× 注册会员免费下载(下载后可以自由复制和排版)
注册会员下载
全站内容免费自由复制
注册会员下载
全站内容免费自由复制
注:下载文档有可能“只有目录或者内容不全”等情况,请下载之前注意辨别,如果您已付费且无法下载或内容有问题,请联系我们协助你处理。
微信: QQ: