用户注册



邮箱:

密码:

用户登录


邮箱:

密码:
记住登录一个月忘记密码?

发表随想


还能输入:200字
云代码 - java代码库

sdaa

2017-05-18 作者: 小鱼宝宝举报

[java]代码库

package Main_Frame;
 
import java.awt.*;
import java.awt.event.*;
 
import javax.swing.*;
 
import Achieve.*;
 
public class MainFrame extends JFrame {
     
     
    public  CardLayout card = new CardLayout();     //定义卡片布局管理器
    //public final Container p = getContentPane();
    JMenuBar MenuBar = new JMenuBar();    //定义菜单条
     
    JMenu     //定义主菜单
    bk_manage = new JMenu("图书管理"),
    jy_manage = new JMenu("借阅管理"),
    rd_manage = new JMenu("读者管理"),
    help = new JMenu("帮助"),
    readermanage = new JMenu("借阅人管理");
     
    JMenuItem
    readermessage = new JMenuItem("借阅人信息"),
    add_man = new JMenuItem("添加借阅人"),
    alter_reader = new JMenuItem("修改借阅人信息"),
    delete_man = new JMenuItem("删除借阅人");
     
     
    JMenuItem   //定义子菜单
    look_up = new JMenuItem("详细查询"),
    all_book = new JMenuItem("图书概览"),
    alter_book = new JMenuItem("修改图书信息"),
    borrow_book = new JMenuItem("借书"),
    back_book = new JMenuItem("还书"),
    pay = new JMenuItem("读者缴费"),
    borrowReader_manage = new JMenuItem("借阅信息"),
    look_introdece = new JMenuItem("系统介绍"),
    about = new JMenuItem("关于");
     
     
     
    //卡片面版转换监听
    back_Frame backP = new back_Frame();
    bookInfo_Frame bookInfoP = new bookInfo_Frame();
    borrow_Frame borrowP = new borrow_Frame();
    readerManage_Frame readerP = new readerManage_Frame();
    Add_Borrow_Man addman = new Add_Borrow_Man();
    BorrowMessage query = new BorrowMessage();
    Del_Borrow_Man delete = new Del_Borrow_Man();
    Pay payp = new Pay();
    Alter_Frame alter= new Alter_Frame();
    Alter_Reader_Message arm= new Alter_Reader_Message();
     
     
     
    public void edit_MenuBar(){
        MenuBar.add(bk_manage);
        MenuBar.add(jy_manage);
        MenuBar.add(rd_manage);
        MenuBar.add(help);
        bk_manage.add(look_up);
        bk_manage.add(all_book);
        bk_manage.add(alter_book);
        jy_manage.add(borrow_book);
        jy_manage.add(back_book);
        rd_manage.add(readermanage);
        readermanage.add(readermessage);
        readermanage.add(add_man);
        readermanage.add(alter_reader);
        readermanage.add(delete_man);
        rd_manage.add(borrowReader_manage);
        rd_manage.add(pay);
        help.add(look_introdece);
        help.add(about);
    }
    public MainFrame(){
         
        this.setTitle("计算机工程系图书管理系统");
        this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
        this.setBounds(300, 200, 640, 430);
        this.setResizable(false);
        this.setJMenuBar(MenuBar);
        this.edit_MenuBar();
         
        final Container p = getContentPane();
 
        p.setLayout(card);
         
        ImageIcon bg = new ImageIcon("图片\\背景.jpg");
        // 加载背景图片      
        JLabel label = new JLabel(bg);     
        // 把背景图片显示在一个标签里
        label.setBounds(0,0,bg.getIconWidth(),bg.getIconHeight());     
        //把标签的大小位置设置为图片刚好填充整个面
        this.getLayeredPane().add(label,new Integer(Integer.MIN_VALUE));   
        //添加图片到frame的第二层        
        JPanel jp=(JPanel)this.getContentPane();   
        //获取frame的最上层面板为了设置其背景颜色(JPanel有设置透明的方法)        
        jp.setOpaque(false);
         
        p.add(new Welcome_Frame().welcome(),"card11");
                 
        look_up.addActionListener(new ActionListener(){
 
            public void actionPerformed(ActionEvent e) {
                p.add(bookInfoP.bookPanel(),"card1");
            card.show(p, "card1");
            }
             
        });
         
        borrow_book.addActionListener(new ActionListener(){
 
            public void actionPerformed(ActionEvent arg0) {
                p.add(borrowP.borrowPanel(),"card2");
                card.show(p, "card2");
            }
             
        });
        back_book.addActionListener(new ActionListener(){
 
            public void actionPerformed(ActionEvent arg0) {
                p.add(backP.backPanel(),"card3");
                card.show(p,"card3");
            }
             
        });
        borrowReader_manage.addActionListener(new ActionListener(){
             
            public void actionPerformed(ActionEvent arg0) {
                p.add(readerP.readerManagePanel(),"card4");
                card.show(p, "card4");
            }
             
        });
        add_man.addActionListener(new ActionListener(){
 
            public void actionPerformed(ActionEvent e) {
                p.add(addman.add_man(),"card5");
                card.show(p, "card5");
            }
             
        });
        readermessage.addActionListener(new ActionListener(){
 
            public void actionPerformed(ActionEvent e) {
                p.add(query.query_brman(),"card6");
                card.show(p,"card6");
                 
            }
             
        });
         
        delete_man.addActionListener(new ActionListener(){
 
            public void actionPerformed(ActionEvent e) {
                p.add(delete.delete(),"card7");
                card.show(p, "card7");
            }
             
        });
        pay.addActionListener(new ActionListener(){
 
            public void actionPerformed(ActionEvent e) {
                p.add(payp.pay(),"card8");
                card.show(p, "card8");
            }
             
        });
         
        alter_book.addActionListener(new ActionListener(){
 
            public void actionPerformed(ActionEvent e) {
                p.add(alter.alter_book(),"card9");
                card.show(p, "card9");
            }
             
        });
         
        alter_reader.addActionListener(new ActionListener(){
 
            public void actionPerformed(ActionEvent e) {
                p.add(arm.alterreader(),"card10");
                card.show(p, "card10");
            }
             
        });
         
        look_introdece.addActionListener(new ActionListener(){
 
            public void actionPerformed(ActionEvent e) {
                new Introduce_Frame();
            }
             
        });
        all_book.addActionListener(new ActionListener(){
 
            public void actionPerformed(ActionEvent e) {
                new All_Book_Frame();
            }
             
        });
         
         
        about.addActionListener(new ActionListener(){
 
            public void actionPerformed(ActionEvent e) {
                new Copyright_Frame();
            }
             
        });
         
        this.setVisible(true);
        this.setDefaultCloseOperation(DO_NOTHING_ON_CLOSE);
        this.addWindowListener(new WindowAdapter(){
            public void windowClosing(WindowEvent e) {
        int option = JOptionPane.showConfirmDialog(MainFrame.this,"你确定要退出系统?","温馨提示",JOptionPane.YES_NO_OPTION); 
        if(option==JOptionPane.YES_NO_OPTION) {
            if (e.getWindow() == MainFrame.this) {
                System.exit(0);
            }
            else{
                return;
            }
        }
    }
        });
    }
 
}


网友评论    (发表评论)

共3 条评论 1/1页

发表评论:

评论须知:

  • 1、评论每次加2分,每天上限为30;
  • 2、请文明用语,共同创建干净的技术交流环境;
  • 3、若被发现提交非法信息,评论将会被删除,并且给予扣分处理,严重者给予封号处理;
  • 4、请勿发布广告信息或其他无关评论,否则将会删除评论并扣分,严重者给予封号处理。


扫码下载

加载中,请稍后...

输入口令后可复制整站源码

加载中,请稍后...