为了正常的体验网站,请在浏览器设置里面开启Javascript功能!

《蓝梦教育集团即时通讯系统》(仿腾讯QQ)——信息主窗口类中的各个子面板和弹出式菜单程序类(第1部分)

2017-10-23 18页 doc 51KB 7阅读

用户头像

is_731942

暂无简介

举报
《蓝梦教育集团即时通讯系统》(仿腾讯QQ)——信息主窗口类中的各个子面板和弹出式菜单程序类(第1部分)《蓝梦教育集团即时通讯系统》(仿腾讯QQ)——信息主窗口类中的各个子面板和弹出式菜单程序类(第1部分) 《蓝梦教育集团即时通讯系统》(仿腾讯QQ)——信息主窗口 类中的各个子面板和弹出式菜单程序类(第1部分) 杨教授大学堂 精心创作的优秀程序员 职业提升必读系列资料 J2EE课程设计实训教学示例项目《蓝梦教育集团即时通讯系统》(仿腾 讯QQ)——完善客户端系统信息主窗口类中的各个子面板和弹出式菜单程序类(第1/2部分) 1.1.1 完善客户端系统信息主窗口类中的各个子面板 1、添加一个模板模式中的抽象基类 (1)...
《蓝梦教育集团即时通讯系统》(仿腾讯QQ)——信息主窗口类中的各个子面板和弹出式菜单程序类(第1部分)
《蓝梦教育集团即时通讯系统》(仿腾讯QQ)——信息主窗口类中的各个子面板和弹出式菜单程序类(第1部分) 《蓝梦教育集团即时通讯系统》(仿腾讯QQ)——信息主窗口 类中的各个子面板和弹出式菜单程序类(第1部分) 杨教授大学堂 精心创作的优秀程序员 职业提升必读系列资料 J2EE课程设计实训教学示例项目《蓝梦教育集团即时通讯系统》(仿腾 讯QQ)——完善客户端系统信息主窗口类中的各个子面板和弹出式菜单程序类(第1/2部分) 1.1.1 完善客户端系统信息主窗口类中的各个子面板 1、添加一个模板模式中的抽象基类 (1)类名称为IMSystemMainFrame_LeftToolBarPanel,包名 com.px1987.imsystem.client.frame.imsystemmainframe,继承javax.swing.JPanel类 (2)编程该抽象基类 杨教授大学堂,版权所有,盗版必究。 1/23页 称为 杨教授大学堂 精心创作的优秀程序员 职业提升必读系列资料 package com.px1987.imsystem.client.frame.imsystemmainframe; import java.awt.BorderLayout; import java.net.MalformedURLException; import java.net.URL; import javax.swing.JPanel; import org.jdesktop.jdic.browser.WebBrowser; ——————————————————————————————————————————————— import com.px1987.imsystem.client.exception.IMSystemException; public abstract class IMSystemMainFrame_LeftToolBarPanel extends JPanel { private static final long serialVersionUID = 1L; protected WebBrowser embedWebBrowser=null; protected String targetURLInEmbedWebBrowser=null; public IMSystemMainFrame_LeftToolBarPanel() throws IMSystemException{ } private void initThisPanel() { } public abstract void loadSomeOneContentFromWebServer() throws IMSystemException; public void showTargetURLPageContentInEmbedWebBrowser() throws this.setLayout(new BorderLayout()); embedWebBrowser = new WebBrowser(); initThisPanel(); loadSomeOneContentFromWebServer(); IMSystemException{ try { 杨教授大学堂,版权所有,盗版必究。 2/23页 杨教授大学堂 精心创作的优秀程序员 职业提升必读系列资料 embedWebBrowser.setURL(new URL(targetURLInEmbedWebBrowser)); } catch (MalformedURLException exception) { exception.printStackTrace(); throw new IMSystemException("出现了MalformedURLException异常错误,错误 信息为:\n" + } ——————————————————————————————————————————————— /* JDIC的第三个主要组件是浏览器组件,这个组件给你了一个真正在图形应用里使用的AWT器件。以前,你可以使用第三方的嵌入式组件或纯java的浏览器,但JDIC让你把用户默认的web浏览器嵌入到你的应用中,这些为我们创造了很多机会。现在写一些有全面Web支持的RSS阅读器变成了可能的事情。由于你不必把本地浏览器包含进你的应用中,下载速度也更快了。 浏览器组件API可以让你访问几个浏览器事件以及在历史记录上的控制(向前,后退,刷新)。未来修订的API版本希望能提供更多存取浏览器和任意装载的文档的功能。 MozEmbed.exe和IeEmbed.exe,浏览器组件将立刻使用用户的默认Web浏览器,它们通常是Internet Explorer或Mozilla。 但还需要将IeEmbed.exe放到c:\winnt目录中,否则将会出现下面的错误: Can't execute the native embedded browser. Error message: Cannot run program "IeEmbed.exe": CreateProcess error=2, ????????? */ 2、添加IMSystemMainFrame_LeftToolBar_AddMoneyCenter子类 (1)类名称为IMSystemMainFrame_LeftToolBar_AddMoneyCenter,包名称为com.px1987.imsystem.client.frame.imsystemmainframe,继承 } } exception.getMessage()); com.px1987.imsystem.client.frame.imsystemmainframe.IMSystemMainF ——————————————————————————————————————————————— rame_LeftToolBarPanel类 杨教授大学堂,版权所有,盗版必究。 3/23页 杨教授大学堂 精心创作的优秀程序员 职业提升必读系列资料 (2)编程该类 package com.px1987.imsystem.client.frame.imsystemmainframe; import com.px1987.imsystem.client.constant.IMSystemClientAppConstant; import com.px1987.imsystem.client.exception.IMSystemException; import com.px1987.imsystem.client.util.NetSystemUtil; public class IMSystemMainFrame_LeftToolBar_AddMoneyCenter extends IMSystemMainFrame_LeftToolBarPanel { private static final long serialVersionUID = 1L; 杨教授大学堂,版权所有,盗版必究。 4/23页 杨教授大学堂 精心创作的优秀程序员 职业提升必读系列资料 } public IMSystemMainFrame_LeftToolBar_AddMoneyCenter() throws IMSystemException{ } public void loadSomeOneContentFromWebServer() throws IMSystemException{ targetURLInEmbedWebBrowser = NetSystemUtil. getWebAppContextURL() + "/embedindexpageservlet.action?action=" +super(); IMSystemClientAppConstant.IMSystemClientHttpRequest_jdic_AddMoneyCenterInfoIndex; } ——————————————————————————————————————————————— showTargetURLPageContentInEmbedWebBrowser(); this.add(embedWebBrowser, java.awt.BorderLayout.CENTER); 3、IMSystemMainFrame_LeftToolBar_CFSpaceCenter (1)类名称为IMSystemMainFrame_LeftToolBar_CFSpaceCenter, 包名称为 ,继承com.px1987.imsystem.client.frame.imsystemmainframe com.px1987.imsystem.client.frame.imsystemmainframe.IMSystemMainFrame_LeftToolBarPanel类 杨教授大学堂,版权所有,盗版必究。 5/23页 杨教授大学堂 精心创作的优秀程序员 职业提升必读系列资料 (2)编程该类 package com.px1987.imsystem.client.frame.imsystemmainframe; import com.px1987.imsystem.client.constant.IMSystemClientAppConstant; import com.px1987.imsystem.client.exception.IMSystemException; import com.px1987.imsystem.client.util.NetSystemUtil; public class IMSystemMainFrame_LeftToolBar_CFSpaceCenter extends IMSystemMainFrame_LeftToolBarPanel { private static final long serialVersionUID = 9181096445844674400L; 杨教授大学堂,版权所有,盗版必究。 6/23页 杨教授大学堂 精心创作的优秀程序员 职业提升必读系列资料 ——————————————————————————————————————————————— public IMSystemMainFrame_LeftToolBar_CFSpaceCenter() throws IMSystemException{ super(); } public void loadSomeOneContentFromWebServer() throws IMSystemException{ targetURLInEmbedWebBrowser = NetSystemUtil. getWebAppContextURL() + "/embedindexpageservlet.action?action=" +IMSystemClientAppConstant.IMSystemClientHttpRequest_jdic_CFSpaceCenterCenterInfoI ndex; } } showTargetURLPageContentInEmbedWebBrowser(); this.add(embedWebBrowser, java.awt.BorderLayout.CENTER); 4、IMSystemMainFrame_LeftToolBar_FriendFreeSpace (1)类名称为IMSystemMainFrame_LeftToolBar_FriendFreeSpace, 包名称为com.px1987.imsystem.client.frame.imsystemmainframe,继承 com.px1987.imsystem.client.frame.imsystemmainframe.IMSystemMainFrame_LeftToolBarPanel类 杨教授大学堂,版权所有,盗版必究。 7/23页 杨教授大学堂 精心创作的优秀程序员 职业提升必读系列资料 (2)编程该类 package com.px1987.imsystem.client.frame.imsystemmainframe; import ——————————————————————————————————————————————— com.px1987.imsystem.client.constant.IMSystemClientAppConstant; import com.px1987.imsystem.client.exception.IMSystemException; import com.px1987.imsystem.client.util.NetSystemUtil; public class IMSystemMainFrame_LeftToolBar_FriendFreeSpace extends IMSystemMainFrame_LeftToolBarPanel { private static final long serialVersionUID = 9042801362362458895L; 杨教授大学堂,版权所有,盗版必究。 8/23页 杨教授大学堂 精心创作的优秀程序员 职业提升必读系列资料 public IMSystemMainFrame_LeftToolBar_FriendFreeSpace() throws IMSystemException{ super(); } public void loadSomeOneContentFromWebServer() throws IMSystemException{ targetURLInEmbedWebBrowser = NetSystemUtil. getWebAppContextURL() + "/embedindexpageservlet.action?action=" +IMSystemClientAppConstant.IMSystemClientHttpRequest_jdic_FriendFreeSpaceCenterInfo Index; } } showTargetURLPageContentInEmbedWebBrowser(); this.add(embedWebBrowser, java.awt.BorderLayout.CENTER); 5、IMSystemMainFrame_LeftToolBar_NetHardDisk (1)类名称为IMSystemMainFrame_LeftToolBar_NetHardDisk,包 ——————————————————————————————————————————————— 名称为 ,继承com.px1987.imsystem.client.frame.imsystemmainframe com.px1987.imsystem.client.frame.imsystemmainframe.IMSystemMainFrame_LeftToolBarPanel类 杨教授大学堂,版权所有,盗版必究。 9/23页 杨教授大学堂 精心创作的优秀程序员 职业提升必读系列资料 (2)编程该类 package com.px1987.imsystem.client.frame.imsystemmainframe; import com.px1987.imsystem.client.constant.IMSystemClientAppConstant; import com.px1987.imsystem.client.exception.IMSystemException; import com.px1987.imsystem.client.util.NetSystemUtil; public class IMSystemMainFrame_LeftToolBar_NetHardDisk extends IMSystemMainFrame_LeftToolBarPanel { private static final long serialVersionUID = -2437251062864434009L; 杨教授大学堂,版权所有,盗版必究。 10/23页 杨教授大学堂 精心创作的优秀程序员 职业提升必读系列资料 ex; } public IMSystemMainFrame_LeftToolBar_NetHardDisk() throws IMSystemException{ } public void ——————————————————————————————————————————————— loadSomeOneContentFromWebServer() throws IMSystemException{ targetURLInEmbedWebBrowser = NetSystemUtil. getWebAppContextURL() + "/embedindexpageservlet.action?action=" +super(); IMSystemClientAppConstant.IMSystemClientHttpRequest_jdic_NetHardDiskCenterInfoInd } showTargetURLPageContentInEmbedWebBrowser(); this.add(embedWebBrowser, java.awt.BorderLayout.CENTER); 6、IMSystemMainFrame_LeftToolBar_NetShop (1)类名称为IMSystemMainFrame_LeftToolBar_NetShop,包名 称为 ,继承com.px1987.imsystem.client.frame.imsystemmainframe com.px1987.imsystem.client.frame.imsystemmainframe.IMSystemMainFrame_LeftToolBarPanel类 杨教授大学堂,版权所有,盗版必究。 11/23页 杨教授大学堂 精心创作的优秀程序员 职业提升必读系列资料 (2)编程该类 package com.px1987.imsystem.client.frame.imsystemmainframe; import com.px1987.imsystem.client.constant.IMSystemClientAppConstant; import com.px1987.imsystem.client.exception.IMSystemException; ——————————————————————————————————————————————— import com.px1987.imsystem.client.util.NetSystemUtil; public class IMSystemMainFrame_LeftToolBar_NetShop extends IMSystemMainFrame_LeftToolBarPanel { private static final long serialVersionUID = -3648907454468526825L; 杨教授大学堂,版权所有,盗版必究。 12/23页 杨教授大学堂 精心创作的优秀程序员 职业提升必读系列资料 } public IMSystemMainFrame_LeftToolBar_NetShop() throws IMSystemException{ } public void loadSomeOneContentFromWebServer() throws IMSystemException{ } targetURLInEmbedWebBrowser = NetSystemUtil. getWebAppContextURL() + "/embedindexpageservlet.action?action=" + IMSystemClientAppConstant.IMSystemClientHttpRequest_jdic_NetShopInfoIndex; showTargetURLPageContentInEmbedWebBrowser(); this.add(embedWebBrowser, java.awt.BorderLayout.CENTER); super(); 7、IMSystemMainFrame_LeftToolBar_QMoneyCenter (1)类名称为IMSystemMainFrame_LeftToolBar_QMoneyCenter, 包名称为 ,继承com.px1987.imsystem.client.frame.imsystemmainframe com.px1987.imsystem.client.frame.imsystemmainframe.IMSystemMainF——————————————————————————————————————————————— rame_LeftToolBarPanel类 杨教授大学堂,版权所有,盗版必究。 13/23页 杨教授大学堂 精心创作的优秀程序员 职业提升必读系列资料 (2)编程该类 package com.px1987.imsystem.client.frame.imsystemmainframe; import com.px1987.imsystem.client.constant.IMSystemClientAppConstant; import com.px1987.imsystem.client.exception.IMSystemException; import com.px1987.imsystem.client.util.NetSystemUtil; public class IMSystemMainFrame_LeftToolBar_QMoneyCenter extends IMSystemMainFrame_LeftToolBarPanel { private static final long serialVersionUID = 1850689691545163037L; 杨教授大学堂,版权所有,盗版必究。 14/23页 杨教授大学堂 精心创作的优秀程序员 职业提升必读系列资料 public IMSystemMainFrame_LeftToolBar_QMoneyCenter() throws IMSystemException{ super(); } public void loadSomeOneContentFromWebServer() throws IMSystemException{ targetURLInEmbedWebBrowser = NetSystemUtil. getWebAppContextURL() + "/embedindexpageservlet.action?action=" +IMSystemClientAppConstant.IMSystemClientHttpRequest_jdic_QMone——————————————————————————————————————————————— yCenterCenterInfoI ndex; } } showTargetURLPageContentInEmbedWebBrowser(); this.add(embedWebBrowser, java.awt.BorderLayout.CENTER); 8、IMSystemMainFrame_LeftToolBar_QQLoveWall (1)类名称为IMSystemMainFrame_LeftToolBar_QQLoveWall,包 名称为 ,继承com.px1987.imsystem.client.frame.imsystemmainframe com.px1987.imsystem.client.frame.imsystemmainframe.IMSystemMainFrame_LeftToolBarPanel类 杨教授大学堂,版权所有,盗版必究。 15/23页 杨教授大学堂 精心创作的优秀程序员 职业提升必读系列资料 (2)编程该类 package com.px1987.imsystem.client.frame.imsystemmainframe; import com.px1987.imsystem.client.constant.IMSystemClientAppConstant; import com.px1987.imsystem.client.exception.IMSystemException; import com.px1987.imsystem.client.util.NetSystemUtil; public class IMSystemMainFrame_LeftToolBar_QQLoveWall extends IMSystemMainFrame_LeftToolBarPanel { private static final long serialVersionUID = ——————————————————————————————————————————————— -6670083790037034026L; 杨教授大学堂,版权所有,盗版必究。 16/23页 杨教授大学堂 精心创作的优秀程序员 职业提升必读系列资料 public IMSystemMainFrame_LeftToolBar_QQLoveWall() throws IMSystemException{ super(); } public void loadSomeOneContentFromWebServer() throws IMSystemException{ targetURLInEmbedWebBrowser = NetSystemUtil. getWebAppContextURL() + "/embedindexpageservlet.action?action=" +IMSystemClientAppConstant.IMSystemClientHttpRequest_jdic_QQLoveWallCenterCenterI nfoIndex; } } showTargetURLPageContentInEmbedWebBrowser(); this.add(embedWebBrowser, java.awt.BorderLayout.CENTER); 9、IMSystemMainFrame_LeftToolBar_QQPlayCenter (1)类名称为IMSystemMainFrame_LeftToolBar_QQPlayCenter, 包名称为 ,继承com.px1987.imsystem.client.frame.imsystemmainframe com.px1987.imsystem.client.frame.imsystemmainframe.IMSystemMainFrame_LeftToolBarPanel类 ——————————————————————————————————————————————— 杨教授大学堂,版权所有,盗版必究。 17/23页 杨教授大学堂 精心创作的优秀程序员 职业提升必读系列资料 (2)编程该类 package com.px1987.imsystem.client.frame.imsystemmainframe; import com.px1987.imsystem.client.constant.IMSystemClientAppConstant; import com.px1987.imsystem.client.exception.IMSystemException; import com.px1987.imsystem.client.util.NetSystemUtil; public class IMSystemMainFrame_LeftToolBar_QQPlayCenter extends IMSystemMainFrame_LeftToolBarPanel { private static final long serialVersionUID = 8230607679451307922L; 杨教授大学堂,版权所有,盗版必究。 18/23页 杨教授大学堂 精心创作的优秀程序员 职业提升必读系列资料 public IMSystemMainFrame_LeftToolBar_QQPlayCenter() throws IMSystemException { super(); } public void loadSomeOneContentFromWebServer() throws IMSystemException{ IMSystemClientAppConstant.IMSystemClientHttpRequest_jdic_QQPlayCenterCenterInfoIn showTargetURLPageContentInEmbedWebBrowser(); ——————————————————————————————————————————————— this.add(embedWebBrowser, java.awt.BorderLayout.CENTER); targetURLInEmbedWebBrowser = NetSystemUtil. getWebAppContextURL() + "/embedindexpageservlet.action?action=" + dex; } } 10、中间树形控件中的自定义渲染类 (1)类名称为FriendsInfoTreeSelfDefineTreeCellRenderer,包名 称为 ,继承于 com.px1987.imsystem.client.frame.imsystemmainframe.tree javax.swing.tree.DefaultTreeCellRenderer 杨教授大学堂,版权所有,盗版必究。 19/23页 杨教授大学堂 精心创作的优秀程序员 职业提升必读系列资料 (2)编程该类 /* 了解 Swing中的渲染器接口 *(1)复合数据类型的组件如JTable、JTree、JList以及JComboBox 都定义适合自己类型的渲染器接口, *(2)它们与渲染器接口之间的映射关系如下所示: JTable —————— 》TableCellRenderer JTree ————》 TreeCellRenderer JList —————》ListCellRenderer JComboBox ————》ListCellRenderer ——————————————————————————————————————————————— */ package com.px1987.imsystem.client.frame.imsystemmainframe.tree; import java.awt.Color; import java.awt.Component; 杨教授大学堂,版权所有,盗版必究。 20/23页 杨教授大学堂 精心创作的优秀程序员 职业提升必读系列资料 import javax.swing.ImageIcon; import javax.swing.JTree; import javax.swing.tree.DefaultMutableTreeNode; import javax.swing.tree.DefaultTreeCellRenderer; import com.px1987.imsystem.serializableVO.UserInfoBaseVO; public class FriendsInfoTreeSelfDefineTreeCellRenderer extends /* * 在重写的getTreeCellRendererComponent中实现对每个节 点进行个性化的渲染,其中的第2个参数 someOneNodeInCenterInfoTree代表树中的某个节点(用户对象)。 * 由于用户对象是Object类型,因此可以将任意类型的对象作为树中 的节点。 */ @Override public Component getTreeCellRendererComponent(JTree centerFriendsInfoTree, ——————————————————————————————————————————————— Object someOneNodeInCenterInfoTree, boolean someOneNodeIsSelected, boolean someOneNodeIsExpanded, boolean someOneNodeIsLeafNode, int rowNumberOfSomeOneNode, DefaultTreeCellRenderer { private static final long serialVersionUID = 1L; public FriendsInfoTreeSelfDefineTreeCellRenderer() { } super(); rendereredThisCenterTreeNode(); boolean hasFocus) { super.getTreeCellRendererComponent(centerFriendsInfoTree, someOneNodeIsSelected, someOneNodeIsExpanded, someOneNodeInCenterInfoTree, someOneNodeIsLeafNode, rowNumberOfSomeOneNode, hasFocus); oneDefaultMutableTreeNode = DefaultMutableTreeNode 杨教授大学堂,版权所有,盗版必究。 21/23页 杨教授大学堂 精心创作的优秀程序员 职业提升必读系列资料 (DefaultMutableTreeNode )someOneNodeInCenterInfoTree; UserInfoBaseVO someOneFindFriendInfoVO =null; boolean isSomeOneFriendInfoNode=oneDefaultMutableTreeNode.isLeaf()&&(oneDefaultMutableTreeNode.getUserObject() instanceof UserInfoBaseVO); if(isSomeOneFriendInfoNode){ someOneFindFriendInfoVO ——————————————————————————————————————————————— //构造 =(UserInfoBaseVO)oneDefaultMutableTreeNode.getUserObject(); DefaultMutableTreeNode时传入的对象 setText(someOneFindFriendInfoVO.getUserAliaoName()+"("+someOneFindFriendInfoVO.getUserIMCode()+")"); } private void rendereredThisCenterTreeNode(){ } return this; this.setIcon(new ImageIcon(getClass().getResource( someOneFindFriendInfoVO.getUserHeadImageFileName()))); return this; this.setOpenIcon(new ImageIcon(getClass().getResource( "/images/treePopMenu/open.gif"))); //设置打开状态的图 this.setClosedIcon(new ImageIcon(getClass().getResource( "/images/treePopMenu/close.gif"))); //设置关闭状态的图 /* 下面设置没有叶子节点的中间节点的初始图标,而对于包装好友 信息的叶节点的图标则在getTreeCellRendererComponent方法中进行 设置 */ this.setLeafIcon(new ImageIcon(getClass().getResource( "/images/treePopMenu/close.gif"))); this.setBackgroundNonSelectionColor(this.getBackground()); //设置节 ——————————————————————————————————————————————— 点选中或者未选中的颜色 杨教授大学堂,版权所有,盗版必究。 22/23页 杨教授大学堂 精心创作的优秀程序员 职业提升必读系列资料 this.setBackgroundSelectionColor(Color.yellow); this.setBorderSelectionColor(Color.red); this.setTextNonSelectionColor(Color.black); this.setTextSelectionColor(Color.blue); 杨教授大学堂,版权所有,盗版必究。23/23页 } } ———————————————————————————————————————————————
/
本文档为【《蓝梦教育集团即时通讯系统》(仿腾讯QQ)——信息主窗口类中的各个子面板和弹出式菜单程序类(第1部分)】,请使用软件OFFICE或WPS软件打开。作品中的文字与图均可以修改和编辑, 图片更改请在作品中右键图片并更换,文字修改请直接点击文字进行修改,也可以新增和删除文档中的内容。
[版权声明] 本站所有资料为用户分享产生,若发现您的权利被侵害,请联系客服邮件isharekefu@iask.cn,我们尽快处理。 本作品所展示的图片、画像、字体、音乐的版权可能需版权方额外授权,请谨慎使用。 网站提供的党政主题相关内容(国旗、国徽、党徽..)目的在于配合国家政策宣传,仅限个人学习分享使用,禁止用于任何广告和商用目的。

历史搜索

    清空历史搜索