電信IP資費管理系統(tǒng)9-15_第1頁
電信IP資費管理系統(tǒng)9-15_第2頁
電信IP資費管理系統(tǒng)9-15_第3頁
電信IP資費管理系統(tǒng)9-15_第4頁
電信IP資費管理系統(tǒng)9-15_第5頁
已閱讀5頁,還剩14頁未讀, 繼續(xù)免費閱讀

下載本文檔

版權(quán)說明:本文檔由用戶提供并上傳,收益歸屬內(nèi)容提供方,若內(nèi)容存在侵權(quán),請進行舉報或認(rèn)領(lǐng)

文檔簡介

1、電信IP資費管理系統(tǒng)代碼重慶文理學(xué)院java課9添加資費import java.awt.*;import javax.swing.*;import java.sql.*;import java.awt.event.*;public class 添加資費 extends JPanel implements ActionListener private JPanel p1;private JTextFieldjt=new JTextField 4;private String s="資費名稱","月租費用","每小時費用","資

2、費描述"private JButton b=new JButton2;public 添加資費()p1=new JPanel(new BorderLayout();p1.add(new JLabel("添加新的資費政策",JLabel.CENTER),"North");JPanel p2=new JPanel(new GridLayout(1,2);JPanel p3=new JPanel(new GridLayout(4,2);p1.add(p2);p2.add(p3);for(int i=0;i<jt.length;i+)p3.add(

3、new JLabel(si);jti=new JTextField();p3.add(jti);JPanel p4=new JPanel(new GridLayout(4,1);p2.add(p4);String s2="請輸入新建資費名稱","請選擇新建的月租費用","請輸入每小時費用","請輸入對新建資費的簡單描述"for(int j=0;j<s2.length;j+)p4.add(new JLabel(s2j);JPanel p5=new JPanel(new java.awt.FlowLayout(F

4、lowLayout.CENTER);String s3="提交","清除"for(int i=0;i<b.length;i+)bi=new JButton(s3i);p5.add(bi);bi.addActionListener(this);p1.add(p5,"South");this.add(p1);this.setVisible(true);public void actionPerformed(ActionEvent e)if(e.getSource()=b0)tryConnection conn;Statement s

5、tmt;Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");conn = DriverManager.getConnection("jdbc:odbc:電信IP資費管理系統(tǒng)");stmt = conn.createStatement();String s1 = ""String s2 = ""s1="p"+jt1.getText()+"-"+jt2.getText();s2="月租"+jt1.getText()+&q

6、uot;元"+","+"每小時"+jt2.getText()+"元"jt0.setText(s1);jt1.setText(s2);String sql="insert into source values('"+jt0.getText()+"','"+jt1.getText()+"','"+jt2.getText()+"','"+s2+"')"stmt.exec

7、uteUpdate(sql);stmt.close();conn.close();this.setVisible(false);this.removeAll();this.add(new 資費列表();this.setVisible(true);catch (SQLException ex) ex.printStackTrace();catch (ClassNotFoundException ex) ex.printStackTrace();if(e.getSource()=b1)for(int i=0;i<jt.length;i+)jti.setText("");

8、10修改個人信息import java.awt.*;import java.awt.event.*;import javax.swing.*;import java.sql.*;public class 修改個人信息 extends JPanel implements ActionListener,ItemListenerprivate JButton 修改;private JLabel label1=new JLabel14;private JTextField textfield1=new JTextField16;private String string1="",&

9、quot;密碼*","重復(fù)密碼*","姓名*","聯(lián)系方式*","電子郵箱*","付款方式*","","職業(yè)","省份","性別","公司","公司郵箱","郵編"private JPasswordField mima,chongfumima;private JRadioButton fukuanfangshi=new JRadioButton3;

10、private JRadioButton 男,女;private JComboBox 省份,職業(yè);private String st1,st2,st3,st4,st5,st6,st7,st8,st9,st10;public 修改個人信息()JPanel p1=new JPanel();p1.setLayout(new BorderLayout();JPanel p3=new JPanel();p1.add(p3,"South");修改=new JButton("修改");p3.add(修改);修改.addActionListener(this);JPan

11、el p4=new JPanel(new GridLayout(14,1);p1.add(p4,"West");for(int i=0;i<14;i+)label1i=new JLabel(string1i);p4.add(label1i);JPanel p5=new JPanel(new GridLayout(1,2,0,20);p1.add(p5,"Center");JPanel p6=new JPanel(new GridLayout(14,1);p5.add(p6);p6.add(new JLabel();mima=new JPasswor

12、dField("123");p6.add(mima);chongfumima=new JPasswordField("132");p6.add(chongfumima);String string2="aaa","62136369","aaa"for(int j=0;j<3;j+)textfield1j=new JTextField(string2j);p6.add(textfield1j);JPanel p7=new JPanel(new GridLayout(1,3);p6.add(p

13、7);ButtonGroup fangshi=new ButtonGroup();String s_fangshi="現(xiàn)金支付","銀行轉(zhuǎn)賬","IP卡充值"for(int i=0;i<3;i+)fukuanfangshii=new JRadioButton(s_fangshii);fangshi.add(fukuanfangshii);if(fukuanfangshii.isSelected()st3=""+s_fangshi+""p6.add(new JLabel();Object z

14、hiye="軟件工程師","部門經(jīng)理","銷售經(jīng)理","業(yè)務(wù)經(jīng)理"職業(yè)=new JComboBox(zhiye);職業(yè).addItemListener(this);p6.add(職業(yè));Object shengfen="北京","上海","河南","吉林","黑龍江","天津"省份=new JComboBox(shengfen);p6.add(省份);省份.addItemListener(this

15、);JPanel p8=new JPanel();p6.add(p8);ButtonGroup bg1=new ButtonGroup();男=new JRadioButton("男",true);bg1.add(男);p8.add(男);女=new JRadioButton("女");bg1.add(女);p8.add(女);for(int i=3;i<6;i+)textfield1i=new JTextField();p6.add(textfield1i);JPanel p9=new JPanel(new GridLayout(14,1);p5

16、.add(p9);p9.add(new JLabel("aaa的資料管理 狀態(tài)正常");p9.add(new JLabel("請輸入用戶的密碼");p9.add(new JLabel("請重復(fù)以上密碼");p9.add(new JLabel("請輸入用戶的真實姓名");p9.add(new JLabel("請輸入有效的聯(lián)系方式");p9.add(new JLabel("請輸入有效的電子郵箱");p9.add(new JLabel();p9.add(new JLabel(&qu

17、ot;以下是附加信息(可不填)");p9.add(new JLabel();p9.add(new JLabel();p9.add(new JLabel();p9.add(new JLabel("請輸入公司名稱(可不填)");p9.add(new JLabel("請輸入公司的電子郵箱(可不填)");p9.add(new JLabel("請輸入公司郵政編碼(可不填)");this.add(p1);this.setVisible(true);public void itemStateChanged(ItemEvent f)st1=

18、""+職業(yè).getSelectedItem()+""st2=""+省份.getSelectedItem()+""if(男.isSelected()st4="男"if(女.isSelected()st4="女"char mm=mima.getPassword();for(int i=0;i<mm.length;i+)st5+=""+mmi+""public void actionPerformed(ActionEvent e)if(

19、e.getSource()=修改)int message=0;Connection con;Statement sql;ResultSet rs;tryClass.forName("sun.jdbc.odbc.JdbcOdbcDriver");con=DriverManager.getConnection("jdbc:odbc:電信IP資費管理系統(tǒng)");sql=con.createStatement(1005,1008);rs=sql.executeQuery("select * from consumer");while(rs.ne

20、xt()if(textfield10.getText().equals(rs.getString("name");message=1;String str1="UPDATE consumer SET password='"+st5+"',"+"name='"+textfield10.getText()+"',"+"telephone='"+textfield11.getText()+"',"+"ma

21、il+'"+textfield12.getText()+"',"+"methord='"+st3+"',work='"+st1+"',"+"province='"+st2+"',sex='"+st4+"',"+"workplace='"+textfield13.getText()+"',"+"mail2

22、='"+textfield14.getText()+"',"+"post='"+textfield15.getText()+"',"+"WHERE name='"+textfield10.getText()+"'"sql.executeUpdate(str1);break;if(message=0)JOptionPane.showMessageDialog(this, "對不起!此用戶名不存在" +"請重新輸

23、入!", "系統(tǒng)提示",JOptionPane.INFORMATION_MESSAGE);/rs.close();sql.close();con.close();this.setVisible(false);this.removeAll();this.add(new 用戶列表();this.setVisible(true);catch(HeadlessException ex)ex.printStackTrace();catch(SQLException ex)ex.printStackTrace();catch(ClassNotFoundException ex

24、)ex.printStackTrace();11用戶管理import java.awt.*;import java.awt.event.*;import javax.swing.*;import java.sql.*;public class 用戶管理 extends JPanel implements ActionListenerprivate JButton 開通賬戶, 用戶列表, 查詢;private JTextField 賬務(wù)賬號;private JPanel p1, p2, p3, p4, p5;private JButton jb = new JButton3;private JS

25、crollPane jsp1;private Connection con;private Statement sql;private ResultSet rs;private int message = 0;public 用戶管理()p1 = new JPanel(new BorderLayout();p2 = new JPanel();p1.add(p2, "North");p2.setLayout(new GridLayout(1, 5, 30, 0);開通賬戶 = new JButton("開通賬戶");開通賬戶.addActionListene

26、r(this);p2.add(開通賬戶);用戶列表 = new JButton("用戶列表");p2.add(用戶列表);用戶列表.addActionListener(this);p2.add(new JLabel("賬務(wù)賬號");賬務(wù)賬號 = new JTextField();p2.add(賬務(wù)賬號);查詢 = new JButton("查詢");p2.add(查詢);查詢.addActionListener(this);p4 = new JPanel(new BorderLayout();p5 = new JPanel(new G

27、ridLayout(17, 1);p4.add(p5, "East");String s2 = "恢復(fù)", "暫停", "刪除"int j = 0;for(j = 0; j<jb.length; j+)jbj = new JButton(s2j);jbj.addActionListener(this);p5.add(jbj);p3 = new JPanel();p1.add(p3, "Center");p3.add(new 用戶列表();this.add(p1);this.setVisib

28、le(true);public void actionPerformed(ActionEvent e)tryClass.forName("sun.jdbc.odbc.JdbcOdbcDriver");con = DriverManager.getConnection("jdbc:odbc:電信IP資費管理系統(tǒng)");sql = con.createStatement(1005, 1008);rs = sql.executeQuery("select * from consumer");while(rs.next()String st1

29、= rs.getString("id");String st2 = 賬務(wù)賬號.getText();if(st2.equals(st1)message = 1;Object ob = new Object16;String s1 = "賬號", "姓名", "電話", "郵箱", "性別", "狀態(tài)"String st4 = rs.getString("state");ob00 = st1;ob01 = rs.getString(&quo

30、t;name");ob02 = rs.getString("telephone");ob03 = rs.getString("mail");ob04 = rs.getString("sex");ob05 = st4;JTable table1 = new JTable(ob, s1);table1.setSize(500, 50);jsp1 = new JScrollPane(table1);jsp1.setPreferredSize(new Dimension(table1.getWidth(), table1.getHe

31、ight();p4.add(jsp1, "Center");if(e.getSource() = jb1)String st3 = "UPDATE consumer SET state = '暫停' WHERE id = ''' + st2 + '''"sql.executeUpdate(st3);if(e.getSource() = jb0)String st5 = "UPDATE consumer SET state = '開通' WHERE id = '

32、;'' + st2 + '''"sql.executeUpdate(st5);if(e.getSource() = jb2)String st6 = "DELETE from consumer WHERE id = ''' + st2 + '''"sql.executeUpdate(st6);p3.setVisible(false);p3.removeAll();p3.add(new 用戶列表();p3.setVisible(true);break;sql.close();co

33、n.close();catch(HeadlessException ex)ex.printStackTrace();catch(SQLException ex)ex.printStackTrace();catch(ClassNotFoundException ex)ex.printStackTrace();if(e.getSource() = 開通賬戶)p3.setVisible(false);p3.removeAll();p3.add(new 開通賬戶();p3.setVisible(true);/break;if(e.getSource() = 用戶列表)p3.setVisible(fal

34、se);p3.removeAll();p3.add(new 用戶列表();p3.setVisible(true);/break;if(e.getSource() = 查詢)if(message = 0)JOptionPane.showMessageDialog(this, "您查詢的用戶不存在", "系統(tǒng)提示", JOptionPane.WARNING_MESSAGE);elsep3.setVisible(false);p3.removeAll();p3.add(p4);p3.setVisible(true);12用戶列表import static ja

35、va.lang.System.out;import java.awt.*;import java.awt.event.*;import javax.swing.*;import javax.swing.table.*;import java.util.Vector;import java.sql.*;public class 用戶列表 extends JPanel implements ActionListenerprivate JTable m_view;private JPanel p1, p2, p3;public 用戶列表()JPanel p1 = new JPanel(new Bor

36、derLayout();Connection con;Statement stmt;ResultSet rs;tryClass.forName("sun.jdbc.odbc.JdbcOdbcDriver");catch(ClassNotFoundException f)out.println("SQLException:" + f.getLocalizedMessage();trycon = DriverManager.getConnection("jdbc:odbc:電信IP資費管理系統(tǒng)");stmt = con.createSta

37、tement(1005, 1008);rs = stmt.executeQuery("select * from consumer");rs.last();int k = rs.getRow();if(k = 0)JOptionPane.showMessageDialog(this, "您查詢的表為空表!", "系統(tǒng)提示", JOptionPane.WARNING_MESSAGE);rs.beforeFirst();String ob = new Stringk7;for(int i = 0; i<k && rs

38、.next(); i+)obi0 = rs.getString("state");obi1 = rs.getString("id");obi2 = rs.getString("name");obi3 = rs.getString("telephone");obi4 = rs.getString("mail");obi5 = rs.getString("date");String s = "狀態(tài)", "賬務(wù)賬號", "姓名&qu

39、ot;, "電話", "郵箱", "日期",;m_view = new JTable(ob, s);m_view.setSize(700, 700);m_view.setAutoResizeMode(JTable.AUTO_RESIZE_OFF);JScrollPane sPane = new JScrollPane(m_view);sPane.setPreferredSize(new Dimension(m_view.getWidth() - 300, m_view.getHeight() - 300);p3 = new JPane

40、l(new FlowLayout();p1.add(p3, "Center");p3.add(sPane);this.add(p1);this.setVisible(true);con.close();catch(SQLException ex)ex.printStackTrace();public void actionPerformed(ActionEvent e)13用戶自服務(wù)import java.awt.*;import java.awt.event.*;import javax.swing.*;import java.sql.*;public class 用戶自

41、服務(wù) extends JPanel implements ActionListenerprivate JButton button=new JButton2; private JPanel p1,p2,p3;public 用戶自服務(wù)()p1=new JPanel(new BorderLayout();p2=new JPanel();p1.add(p2,"North");String string="修改個人信息","賬單查詢"for(int i=0;i<button.length;i+)buttoni=new JButton(s

42、tringi);buttoni.addActionListener(this);p2.add(buttoni);p3=new JPanel();p1.add(p3,"Center");p3.add(new 賬單查詢();this.add(p1);this.setVisible(true);public void actionPerformed(ActionEvent e)if(e.getActionCommand()="修改個人信息")p3.setVisible(false);p3.removeAll();p3.add(new 修改個人信息();p3.s

43、etVisible(true);if(e.getActionCommand()="賬單查詢")p3.setVisible(false);p3.removeAll();p3.add(new 賬單查詢();p3.setVisible(true);14月賬務(wù)查詢import java.awt.*;import java.awt.event.*;import javax.swing.*;import java.sql.*;public class 月賬務(wù)查詢 extends JPanel implements ActionListener,ItemListener private

44、JComboBox 年,月; private JButton button; private JTable zhangwu; private String st1,st2,aline="" private JTextArea ta; private JPanel p4; public 月賬務(wù)查詢() JPanel p3=new JPanel(new BorderLayout(); p4=new JPanel(); Connection con; ResultSet rs; Statement sql; try Class.forName("sun.jdbc.odb

45、c.JdbcOdbcDriver"); catch(ClassNotFoundException ex) System.out.println("error:"+ex); try con=DriverManager.getConnection("jdbc:odbc:電信IP資費管理系統(tǒng)"); sql=con.createStatement(1005,1007); rs=sql.executeQuery("select * from serve"); rs.last(); int k=rs.getRow(); if(k=0)

46、JOptionPane.showMessageDialog(this,"您查詢的表為空表!","系統(tǒng)提 示",JOptionPane.WARNING_MESSAGE); rs.beforeFirst(); Object obj=new Objectk2; for(int i=0;i<k&&rs.next();i+) obji0=rs.getString("serve"); obji1=rs.getString("all"); String s1="服務(wù)器","總計

47、(單位:小時)" zhangwu=new JTable(obj,s1); zhangwu.setSize(500,500); JScrollPane jsp1=new JScrollPane(zhangwu); jsp1.setPreferredSize(new Dimension(zhangwu.getWidth(),zhangwu.getHeight(); p4.add(jsp1); p3.add(p4,"Center"); con.close(); catch(Exception el) System.out.println(el+"error:&

48、quot;); JPanel p1=new JPanel(new GridLayout(1,15,20,0); Object obj1="2004","2005","2006","2007" 年=new JComboBox(obj1); p1.add(年); 年.addItemListener(this); p1.add(new JLabel("年"); Object obj2="1","2","3","4",&qu

49、ot;5","6","7","8","9","10","11","12",; 月=new JComboBox(obj2); p1.add(月); 月.addItemListener(this); p1.add(new JLabel("月"); button=new JButton("月賬務(wù)查詢"); button.addActionListener(this); p1.add(button); p3.add(p1,"North"); ta=new JTextArea(); JPanel p2=new JPanel(); p2.add(ta); p3.add(p2,"South&quo

溫馨提示

  • 1. 本站所有資源如無特殊說明,都需要本地電腦安裝OFFICE2007和PDF閱讀器。圖紙軟件為CAD,CAXA,PROE,UG,SolidWorks等.壓縮文件請下載最新的WinRAR軟件解壓。
  • 2. 本站的文檔不包含任何第三方提供的附件圖紙等,如果需要附件,請聯(lián)系上傳者。文件的所有權(quán)益歸上傳用戶所有。
  • 3. 本站RAR壓縮包中若帶圖紙,網(wǎng)頁內(nèi)容里面會有圖紙預(yù)覽,若沒有圖紙預(yù)覽就沒有圖紙。
  • 4. 未經(jīng)權(quán)益所有人同意不得將文件中的內(nèi)容挪作商業(yè)或盈利用途。
  • 5. 人人文庫網(wǎng)僅提供信息存儲空間,僅對用戶上傳內(nèi)容的表現(xiàn)方式做保護處理,對用戶上傳分享的文檔內(nèi)容本身不做任何修改或編輯,并不能對任何下載內(nèi)容負(fù)責(zé)。
  • 6. 下載文件中如有侵權(quán)或不適當(dāng)內(nèi)容,請與我們聯(lián)系,我們立即糾正。
  • 7. 本站不保證下載資源的準(zhǔn)確性、安全性和完整性, 同時也不承擔(dān)用戶因使用這些下載資源對自己和他人造成任何形式的傷害或損失。

評論

0/150

提交評論