课程设计--通讯录管理系统的设计与实现内容摘要:

30)。 ()。 (370, 130, 180, 30)。 ()。 (370, 180, 180, 30)。 ()。 (370, 230, 180, 30)。 ()。 (100, 50, 200, 200)。 (250, 300, 60, 30)。 (350, 300, 60, 30)。 (150, 300, 60, 30)。 (btn1)。 (btn2)。 (btn3)。 (Name)。 (Tel)。 (q)。 (Address)。 (youb)。 (lb2)。 (lb3)。 (lb4)。 (lb5)。 (lb6)。 (this)。 (this)。 (this)。 } /*public void paint(Graphics g) { (g)。 ImageIcon img = new ImageIcon(D:\\)。 ((), 200, 100, 800, 300, this)。 }*/ @Override public void actionPerformed(ActionEvent e) { // TODO 自动生成的方法存根 if(()==btn1){ try { ()。 // 加载驱动程序 String url = jdbc:odbc:chengwz。 // URL 指向要访问的 数据库名 test String user =。 // MySQL 配置时的用户名 String password =。 // MySQL 配置时的密码 ResultSet rs=null。 Connection connection = (url, user,password)。 // 连续数据库 if (!()) (Succeeded connecting to the Database!)。 Statement statement = ()。 // statement 用来执行SQL 语句 PreparedStatement pre=null。 String str2=str1[f]。 String sq2=delete * from cwz where name=?。 pre=(sq2)。 //要执行的 SQL (1, str2)。 ()。 ()。 ()。 } catch (Exception ee) { ()。 (============删除时:抛出异常 ===========)。 } (f)。 for (int d = f。 d j。 d++) { str1[d] = str1[d + 1]。 str2[d] = str2[d + 1]。 str3[d] = str3[d + 1]。 str4[d] = str4[d + 1]。 str5[d] = str5[d + 1]。 } j。 f。 (null, 数据删除成功。 )。 } else if(()==btn2){ dispose()。 (0)。 } else if(()==btn3){ new Revisefriend(f)。 } } } /**/ mypan pn2=new mypan(f)。 mypan pnc=new mypan(f)。 JLabel Name, Tel, q, Address, youb,lb2,lb3,lb4,lb5,lb6。 JButton btn1, btn2,btn3。 public myframe(){ try { ()。 // 加载驱动程序 String url = jdbc:odbc:chengwz。 // URL 指向要访问的数据库名 test String user =。 // MySQL 配置时的用户名 String password =。 // MySQL 配置时的密码 Connection connection = (url, user, password)。 // 连续数据库 if(!()) (Succeeded connecting to the Database!)。 Statement statement = ()。 // statement 用来执行 SQL 语句 String sql = select * from cwz。 // 要执行的 SQL 语句 ResultSet rs = (sql)。 // 执行 SQL 语句并返回结果集 String name = null。 String phone=null。 String =null。 String youbian=null。 String address=null。 while(()) { name = (name)。 // 选择 sname 这列数据 phone=(phone)。 =()。 address=(address)。 youbian=(postcard)。 str1[j] = name。 str2[j] = phone。 str3[j] =。 str4[j] = address。 str5[j] = youbian。 j++。 (name+ +phone+ +address)。 } ()。 // 关闭结果集 ()。 // 关闭连接 } catch(ClassNotFoundException e) { (Sorry,can`t find the Driver!)。 ()。 } catch(SQLException e) { ()。 } catch(Exception e) { ()。 } JPanel pn=new JPanel()。 JPanel pn3=new JPanel()。 mypan pn2=new mypan(f)。 mb=new JMenuBar()。 mu1=new JMenu(好友操作 )。 mi1=new JMenuItem(修改 )。 mi2=new JMenuItem(删除)。 mu2=new JMenu(查询 )。 mi3=new JMenuItem(按姓名 )。 mi4=new JMenuItem(按电话 )。 mu3=new JMenu(新增 )。 mi5=new JMenuItem(新建联系人 )。 mu4=new JMenu(帮助 )。 mi6=new JMenuItem(关于 )。 mi7=new JMenuItem(退出系统 )。 setJMenuBar(mb)。 (mu1)。 (mi1)。 (mi2)。 (mu2)。 (mi3)。 (mi4)。 (mu3)。 (mi5)。 (mu4)。 (mi6)。 (mi7)。 ( )。 (lb)。 lt=new JList(dm)。 ()。 //选中后的字体颜色 ()。 JScrollPane sp=new JScrollPane(lt)。 ImageIcon icon=new ImageIcon(D:\\)。 JLabel lbn=new JLabel(8,icon,)。 (lbn)。 add(sp,West)。 add(pn,South)。 add(pn2,Center)。 add(pn3,North)。 (this)。 (this)。 (this)。 (this)。 (this)。 (this)。 (this)。 (this)。 setSize(800,570)。 setTitle(通讯录 )。 setVisible(true)。 setResizable(false)。 //缩放 setDefaultCloseOperation()。 setLocationRelativeTo(null)。 (true)。 /*Font font=new Font(JFrame,14)。 Enumeration keys=().keys()。 while(()){ Object key=()。 if((key)instanceof Font)(keys, font)。 }*/ } public void actionPerformed(ActionEvent e){ if(()==mi1){ new ReviseFriendname()。 } else if(()==mi2){ new Deletefriend()。 } else if(()==mi3){ new Searchfriend()。 } else if(()==mi4){ new search2()。 } else if(()==mi5){ new Addfriend()。 } else if(()==mi6){ new about ()。 } else if(()==mi7){ ()。 } } @Override public void mouseClicked(MouseEvent e) { // TODO 自动生成的方法存根 if (() == 1) { int index=(())。 f=index。 ()。 (balck)。 Name = new JLabel(str1[index]+ 的联系方式 )。 Tel = new JLabel(电话 :)。 lb2=new JLabel(str2[index])。 q = new JLabel(:)。 lb3=new JLabel(str3[index])。 Address = new JLabel(地址 :)。 lb4=new JLabel(str4[index])。 youb=new JLabel(邮编 )。 lb5=new JLabel(str5[index])。 ImageIcon img6 = new ImageIcon(D:\\workspace\\image\\)。 if(index==1)img6 = new ImageIcon(D:\\workspace\\image\\)。 if(index==2)img6 = new ImageIcon(D:\\workspace\\image\\)。 if(index==3)img6=new ImageIcon(D:\\workspace\\image\\)。 if(index==4)img6 = new ImageIcon(D:\\workspace\\image\\)。 if(index==4)img6 = new ImageIcon(D:\\workspace\\image\\)。 if(index==5)img6 = new ImageIcon(D:\\workspace\\image\\)。 if(index==6)img6 = new ImageIcon(D:\\workspace\\image\\)。 if(index==7)img6 = new ImageIcon(D:\\workspace\\image\\)。 if(index==8)img6 = new ImageIcon(D:\\workspace\\image\\)。 if(in。
阅读剩余 0%
本站所有文章资讯、展示的图片素材等内容均为注册用户上传(部分报媒/平媒内容转载自网络合作媒体),仅供学习参考。 用户通过本站上传、发布的任何内容的知识产权归属用户或原始著作权人所有。如有侵犯您的版权,请联系我们反馈本站将在三个工作日内改正。