[Java] 图书 →→→→→进入此内容的聊天室

来自 , 2020-07-19, 写在 Java, 查看 151 次.
URL http://www.code666.cn/view/bffc9834
  1. package Main_Frame;
  2.  
  3.  
  4.  
  5.  
  6.  
  7. import java.awt.*;
  8.  
  9.  
  10. import java.awt.event.*;
  11.  
  12.  
  13.  
  14.  
  15.  
  16. import javax.swing.*;
  17.  
  18.  
  19.  
  20.  
  21.  
  22. import Achieve.*;
  23.  
  24.  
  25.  
  26.  
  27.  
  28. public class MainFrame extends JFrame {
  29.  
  30.  
  31.      
  32.  
  33.  
  34.      
  35.  
  36.  
  37.     public  CardLayout card = new CardLayout();     //定义卡片布局管理器
  38.  
  39.  
  40.     //public final Container p = getContentPane();
  41.  
  42.  
  43.     JMenuBar MenuBar = new JMenuBar();    //定义菜单条
  44.  
  45.  
  46.      
  47.  
  48.  
  49.     JMenu     //定义主菜单
  50.  
  51.  
  52.     bk_manage = new JMenu("图书管理"),
  53.  
  54.  
  55.     jy_manage = new JMenu("借阅管理"),  
  56.  
  57.  
  58.     rd_manage = new JMenu("读者管理"),
  59.  
  60.  
  61.     help = new JMenu("帮助"),
  62.  
  63.  
  64.     readermanage = new JMenu("借阅人管理");
  65.  
  66.  
  67.      
  68.  
  69.  
  70.     JMenuItem
  71.  
  72.  
  73.     readermessage = new JMenuItem("借阅人信息"),
  74.  
  75.  
  76.     add_man = new JMenuItem("添加借阅人"),
  77.  
  78.  
  79.     alter_reader = new JMenuItem("修改借阅人信息"),
  80.  
  81.  
  82.     delete_man = new JMenuItem("删除借阅人");
  83.  
  84.  
  85.      
  86.  
  87.  
  88.      
  89.  
  90.  
  91.     JMenuItem   //定义子菜单
  92.  
  93.  
  94.     look_up = new JMenuItem("详细查询"),  
  95.  
  96.  
  97.     all_book = new JMenuItem("图书概览"),
  98.  
  99.  
  100.     alter_book = new JMenuItem("修改图书信息"),
  101.  
  102.  
  103.     borrow_book = new JMenuItem("借书"),
  104.  
  105.  
  106.     back_book = new JMenuItem("还书"),
  107.  
  108.  
  109.     pay = new JMenuItem("读者缴费"),
  110.  
  111.  
  112.     borrowReader_manage = new JMenuItem("借阅信息"),
  113.  
  114.  
  115.     look_introdece = new JMenuItem("系统介绍"),
  116.  
  117.  
  118.     about = new JMenuItem("关于");
  119.  
  120.  
  121.      
  122.  
  123.  
  124.      
  125.  
  126.  
  127.      
  128.  
  129.  
  130.     //卡片面版转换监听
  131.  
  132.  
  133.     back_Frame backP = new back_Frame();
  134.  
  135.  
  136.     bookInfo_Frame bookInfoP = new bookInfo_Frame();
  137.  
  138.  
  139.     borrow_Frame borrowP = new borrow_Frame();
  140.  
  141.  
  142.     readerManage_Frame readerP = new readerManage_Frame();
  143.  
  144.  
  145.     Add_Borrow_Man addman = new Add_Borrow_Man();
  146.  
  147.  
  148.     BorrowMessage query = new BorrowMessage();
  149.  
  150.  
  151.     Del_Borrow_Man delete = new Del_Borrow_Man();
  152.  
  153.  
  154.     Pay payp = new Pay();
  155.  
  156.  
  157.     Alter_Frame alter= new Alter_Frame();
  158.  
  159.  
  160.     Alter_Reader_Message arm= new Alter_Reader_Message();
  161.  
  162.  
  163.      
  164.  
  165.  
  166.      
  167.  
  168.  
  169.      
  170.  
  171.  
  172.     public void edit_MenuBar(){
  173.  
  174.  
  175.         MenuBar.add(bk_manage);
  176.  
  177.  
  178.         MenuBar.add(jy_manage);
  179.  
  180.  
  181.         MenuBar.add(rd_manage);
  182.  
  183.  
  184.         MenuBar.add(help);
  185.  
  186.  
  187.         bk_manage.add(look_up);
  188.  
  189.  
  190.         bk_manage.add(all_book);
  191.  
  192.  
  193.         bk_manage.add(alter_book);
  194.  
  195.  
  196.         jy_manage.add(borrow_book);
  197.  
  198.  
  199.         jy_manage.add(back_book);
  200.  
  201.  
  202.         rd_manage.add(readermanage);
  203.  
  204.  
  205.         readermanage.add(readermessage);
  206.  
  207.  
  208.         readermanage.add(add_man);
  209.  
  210.  
  211.         readermanage.add(alter_reader);
  212.  
  213.  
  214.         readermanage.add(delete_man);
  215.  
  216.  
  217.         rd_manage.add(borrowReader_manage);
  218.  
  219.  
  220.         rd_manage.add(pay);
  221.  
  222.  
  223.         help.add(look_introdece);
  224.  
  225.  
  226.         help.add(about);
  227.  
  228.  
  229.     }
  230.  
  231.  
  232.     public MainFrame(){
  233.  
  234.  
  235.          
  236.  
  237.  
  238.         this.setTitle("计算机工程系图书管理系统");
  239.  
  240.  
  241.         this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
  242.  
  243.  
  244.         this.setBounds(300, 200, 640, 430);
  245.  
  246.  
  247.         this.setResizable(false);
  248.  
  249.  
  250.         this.setJMenuBar(MenuBar);
  251.  
  252.  
  253.         this.edit_MenuBar();
  254.  
  255.  
  256.          
  257.  
  258.  
  259.         final Container p = getContentPane();
  260.  
  261.  
  262.  
  263.  
  264.  
  265.         p.setLayout(card);
  266.  
  267.  
  268.          
  269.  
  270.  
  271.         ImageIcon bg = new ImageIcon("图片\\背景.jpg");  
  272.  
  273.  
  274.         // 加载背景图片        
  275.  
  276.  
  277.         JLabel label = new JLabel(bg);      
  278.  
  279.  
  280.         // 把背景图片显示在一个标签里  
  281.  
  282.  
  283.         label.setBounds(0,0,bg.getIconWidth(),bg.getIconHeight());      
  284.  
  285.  
  286.         //把标签的大小位置设置为图片刚好填充整个面
  287.  
  288.  
  289.         this.getLayeredPane().add(label,new Integer(Integer.MIN_VALUE));    
  290.  
  291.  
  292.         //添加图片到frame的第二层          
  293.  
  294.  
  295.         JPanel jp=(JPanel)this.getContentPane();    
  296.  
  297.  
  298.         //获取frame的最上层面板为了设置其背景颜色(JPanel有设置透明的方法)          
  299.  
  300.  
  301.         jp.setOpaque(false);
  302.  
  303.  
  304.          
  305.  
  306.  
  307.         p.add(new Welcome_Frame().welcome(),"card11");
  308.  
  309.  
  310.                  
  311.  
  312.  
  313.         look_up.addActionListener(new ActionListener(){
  314.  
  315.  
  316.  
  317.  
  318.  
  319.             public void actionPerformed(ActionEvent e) {
  320.  
  321.  
  322.                 p.add(bookInfoP.bookPanel(),"card1");
  323.  
  324.  
  325.             card.show(p, "card1");
  326.  
  327.  
  328.             }
  329.  
  330.  
  331.              
  332.  
  333.  
  334.         });
  335.  
  336.  
  337.          
  338.  
  339.  
  340.         borrow_book.addActionListener(new ActionListener(){
  341.  
  342.  
  343.  
  344.  
  345.  
  346.             public void actionPerformed(ActionEvent arg0) {
  347.  
  348.  
  349.                 p.add(borrowP.borrowPanel(),"card2");
  350.  
  351.  
  352.                 card.show(p, "card2");
  353.  
  354.  
  355.             }
  356.  
  357.  
  358.              
  359.  
  360.  
  361.         });
  362.  
  363.  
  364.         back_book.addActionListener(new ActionListener(){
  365.  
  366.  
  367.  
  368.  
  369.  
  370.             public void actionPerformed(ActionEvent arg0) {
  371.  
  372.  
  373.                 p.add(backP.backPanel(),"card3");
  374.  
  375.  
  376.                 card.show(p,"card3");
  377.  
  378.  
  379.             }
  380.  
  381.  
  382.              
  383.  
  384.  
  385.         });
  386.  
  387.  
  388.         borrowReader_manage.addActionListener(new ActionListener(){
  389.  
  390.  
  391.              
  392.  
  393.  
  394.             public void actionPerformed(ActionEvent arg0) {
  395.  
  396.  
  397.                 p.add(readerP.readerManagePanel(),"card4");
  398.  
  399.  
  400.                 card.show(p, "card4");
  401.  
  402.  
  403.             }
  404.  
  405.  
  406.              
  407.  
  408.  
  409.         });
  410.  
  411.  
  412.         add_man.addActionListener(new ActionListener(){
  413.  
  414.  
  415.  
  416.  
  417.  
  418.             public void actionPerformed(ActionEvent e) {
  419.  
  420.  
  421.                 p.add(addman.add_man(),"card5");
  422.  
  423.  
  424.                 card.show(p, "card5");
  425.  
  426.  
  427.             }
  428.  
  429.  
  430.              
  431.  
  432.  
  433.         });
  434.  
  435.  
  436.         readermessage.addActionListener(new ActionListener(){
  437.  
  438.  
  439.  
  440.  
  441.  
  442.             public void actionPerformed(ActionEvent e) {
  443.  
  444.  
  445.                 p.add(query.query_brman(),"card6");
  446.  
  447.  
  448.                 card.show(p,"card6");
  449.  
  450.  
  451.                  
  452.  
  453.  
  454.             }
  455.  
  456.  
  457.              
  458.  
  459.  
  460.         });
  461.  
  462.  
  463.          
  464.  
  465.  
  466.         delete_man.addActionListener(new ActionListener(){
  467.  
  468.  
  469.  
  470.  
  471.  
  472.             public void actionPerformed(ActionEvent e) {
  473.  
  474.  
  475.                 p.add(delete.delete(),"card7");
  476.  
  477.  
  478.                 card.show(p, "card7");
  479.  
  480.  
  481.             }
  482.  
  483.  
  484.              
  485.  
  486.  
  487.         });
  488.  
  489.  
  490.         pay.addActionListener(new ActionListener(){
  491.  
  492.  
  493.  
  494.  
  495.  
  496.             public void actionPerformed(ActionEvent e) {
  497.  
  498.  
  499.                 p.add(payp.pay(),"card8");
  500.  
  501.  
  502.                 card.show(p, "card8");
  503.  
  504.  
  505.             }
  506.  
  507.  
  508.              
  509.  
  510.  
  511.         });
  512.  
  513.  
  514.          
  515.  
  516.  
  517.         alter_book.addActionListener(new ActionListener(){
  518.  
  519.  
  520.  
  521.  
  522.  
  523.             public void actionPerformed(ActionEvent e) {
  524.  
  525.  
  526.                 p.add(alter.alter_book(),"card9");
  527.  
  528.  
  529.                 card.show(p, "card9");
  530.  
  531.  
  532.             }
  533.  
  534.  
  535.              
  536.  
  537.  
  538.         });
  539.  
  540.  
  541.          
  542.  
  543.  
  544.         alter_reader.addActionListener(new ActionListener(){
  545.  
  546.  
  547.  
  548.  
  549.  
  550.             public void actionPerformed(ActionEvent e) {
  551.  
  552.  
  553.                 p.add(arm.alterreader(),"card10");
  554.  
  555.  
  556.                 card.show(p, "card10");
  557.  
  558.  
  559.             }
  560.  
  561.  
  562.              
  563.  
  564.  
  565.         });
  566.  
  567.  
  568.          
  569.  
  570.  
  571.         look_introdece.addActionListener(new ActionListener(){
  572.  
  573.  
  574.  
  575.  
  576.  
  577.             public void actionPerformed(ActionEvent e) {
  578.  
  579.  
  580.                 new Introduce_Frame();
  581.  
  582.  
  583.             }
  584.  
  585.  
  586.              
  587.  
  588.  
  589.         });
  590.  
  591.  
  592.         all_book.addActionListener(new ActionListener(){
  593.  
  594.  
  595.  
  596.  
  597.  
  598.             public void actionPerformed(ActionEvent e) {
  599.  
  600.  
  601.                 new All_Book_Frame();
  602.  
  603.  
  604.             }
  605.  
  606.  
  607.              
  608.  
  609.  
  610.         });
  611.  
  612.  
  613.          
  614.  
  615.  
  616.          
  617.  
  618.  
  619.         about.addActionListener(new ActionListener(){
  620.  
  621.  
  622.  
  623.  
  624.  
  625.             public void actionPerformed(ActionEvent e) {
  626.  
  627.  
  628.                 new Copyright_Frame();
  629.  
  630.  
  631.             }
  632.  
  633.  
  634.              
  635.  
  636.  
  637.         });
  638.  
  639.  
  640.          
  641.  
  642.  
  643.         this.setVisible(true);
  644.  
  645.  
  646.         this.setDefaultCloseOperation(DO_NOTHING_ON_CLOSE);
  647.  
  648.  
  649.         this.addWindowListener(new WindowAdapter(){
  650.  
  651.  
  652.             public void windowClosing(WindowEvent e) {  
  653.  
  654.  
  655.         int option = JOptionPane.showConfirmDialog(MainFrame.this,"你确定要退出系统?","温馨提示",JOptionPane.YES_NO_OPTION);  
  656.  
  657.  
  658.         if(option==JOptionPane.YES_NO_OPTION) {
  659.  
  660.  
  661.             if (e.getWindow() == MainFrame.this) {  
  662.  
  663.  
  664.                 System.exit(0);
  665.  
  666.  
  667.             }
  668.  
  669.  
  670.             else{
  671.  
  672.  
  673.                 return;
  674.  
  675.  
  676.             }
  677.  
  678.  
  679.         }
  680.  
  681.  
  682.     }
  683.  
  684.  
  685.         });
  686.  
  687.  
  688.     }
  689.  
  690.  
  691.  
  692.  
  693.  
  694. }
  695.  

回复 "图书"

这儿你可以回复上面这条便签

captcha