⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 mdimain.java

📁 图书管理设计文档
💻 JAVA
字号:
/* * MdiMain.java * 说明:主窗体 * 编写:倪少春 * Created on 2004年12月31日, 下午4:47 */public class MdiMain extends javax.swing.JFrame {    private DataConnect dc=null;//自定义数据库连接程序    private Login login=null;    public MdiMain()         {        initComponents();        //对JTable重新加入model        try            {            dc=new DataConnect();//连接处理            }        catch(Exception e)            {            javax.swing.JOptionPane.showMessageDialog(this,"数据连接错误");            System.exit(0);            }        login=new Login(dc);        this.desktopPane.add(login);        }        private void initComponents() {//GEN-BEGIN:initComponents        desktopPane = new javax.swing.JDesktopPane();        menuBar = new javax.swing.JMenuBar();        jm_login = new javax.swing.JMenu();        jmi_login = new javax.swing.JMenuItem();        jm_quit = new javax.swing.JMenuItem();        jm_jh = new javax.swing.JMenu();        jm_BookBorrow = new javax.swing.JMenuItem();        jm_return = new javax.swing.JMenuItem();        jm_table = new javax.swing.JMenu();        jm_tj = new javax.swing.JMenuItem();        jm_da = new javax.swing.JMenu();        jmi_BookDA = new javax.swing.JMenuItem();        jmi_SortDA = new javax.swing.JMenuItem();        helpMenu = new javax.swing.JMenu();        aboutMenuItem = new javax.swing.JMenuItem();        setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);        getContentPane().add(desktopPane, java.awt.BorderLayout.CENTER);        jm_login.setText("\u767b\u9646");        jmi_login.setText("\u767b\u9646");        jmi_login.addActionListener(new java.awt.event.ActionListener() {            public void actionPerformed(java.awt.event.ActionEvent evt) {                jmi_loginActionPerformed(evt);            }        });        jm_login.add(jmi_login);        jm_quit.setText("\u9000\u51fa");        jm_quit.addActionListener(new java.awt.event.ActionListener() {            public void actionPerformed(java.awt.event.ActionEvent evt) {                jm_quitActionPerformed(evt);            }        });        jm_login.add(jm_quit);        menuBar.add(jm_login);        jm_jh.setText("\u501f\u8fd8\u7ba1\u7406");        jm_BookBorrow.setText("\u501f\u4e66\u7ba1\u7406");        jm_BookBorrow.addActionListener(new java.awt.event.ActionListener() {            public void actionPerformed(java.awt.event.ActionEvent evt) {                jm_BookBorrowActionPerformed(evt);            }        });        jm_jh.add(jm_BookBorrow);        jm_return.setText("\u8fd8\u4e66\u7ba1\u7406");        jm_return.addActionListener(new java.awt.event.ActionListener() {            public void actionPerformed(java.awt.event.ActionEvent evt) {                jm_returnActionPerformed(evt);            }        });        jm_jh.add(jm_return);        menuBar.add(jm_jh);        jm_table.setText("\u7edf\u8ba1\u62a5\u8868");        jm_tj.setText("\u7edf\u8ba1\u62a5\u8868");        jm_tj.addActionListener(new java.awt.event.ActionListener() {            public void actionPerformed(java.awt.event.ActionEvent evt) {                jm_tjActionPerformed(evt);            }        });        jm_table.add(jm_tj);        menuBar.add(jm_table);        jm_da.setText("\u6863\u6848\u7ba1\u7406");        jmi_BookDA.setText("\u56fe\u4e66\u6863\u6848");        jmi_BookDA.addActionListener(new java.awt.event.ActionListener() {            public void actionPerformed(java.awt.event.ActionEvent evt) {                jmi_BookDAActionPerformed(evt);            }        });        jmi_BookDA.addMouseListener(new java.awt.event.MouseAdapter() {            public void mouseClicked(java.awt.event.MouseEvent evt) {                jmi_BookDAMouseClicked(evt);            }        });        jm_da.add(jmi_BookDA);        jmi_SortDA.setText("\u56fe\u4e66\u7c7b\u522b\u6863\u6848");        jmi_SortDA.addActionListener(new java.awt.event.ActionListener() {            public void actionPerformed(java.awt.event.ActionEvent evt) {                jmi_SortDAActionPerformed(evt);            }        });        jm_da.add(jmi_SortDA);        menuBar.add(jm_da);        helpMenu.setText("\u5e2e\u52a9");        aboutMenuItem.setText("About");        aboutMenuItem.addActionListener(new java.awt.event.ActionListener() {            public void actionPerformed(java.awt.event.ActionEvent evt) {                aboutMenuItemActionPerformed(evt);            }        });        helpMenu.add(aboutMenuItem);        menuBar.add(helpMenu);        setJMenuBar(menuBar);        pack();    }//GEN-END:initComponents    private void jmi_loginActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jmi_loginActionPerformed        this.desktopPane.add(login);        login.setSize(400,250);        login.setVisible(true);        login.setLocation((desktopPane.getWidth()-400)/2,(desktopPane.getHeight()-250)/2);    }//GEN-LAST:event_jmi_loginActionPerformed    public void goLogin(){jmi_loginActionPerformed(null);}        private void jm_returnActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jm_returnActionPerformed        if(login==null||            login.getLoginOK()==false)            {            this.desktopPane.add(login);            login.setSize(400,250);            login.setVisible(true);            login.setLocation((desktopPane.getWidth()-400)/2,(desktopPane.getHeight()-250)/2);            return;            }            Lend lend=new Lend(dc);        this.desktopPane.add(lend);        lend.setSize(desktopPane.getWidth(), desktopPane.getHeight());        lend.setVisible(true);        lend.setLocation(0,0);    }//GEN-LAST:event_jm_returnActionPerformed    private void jm_quitActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jm_quitActionPerformed        System.exit(0);    }//GEN-LAST:event_jm_quitActionPerformed    private void jm_BookBorrowActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jm_BookBorrowActionPerformed        if(login==null||            login.getLoginOK()==false)            {            this.desktopPane.add(login);            login.setSize(400,250);            login.setVisible(true);            login.setLocation((desktopPane.getWidth()-400)/2,(desktopPane.getHeight()-250)/2);            return;            }        BookBorrow borrow=new BookBorrow(dc);        this.desktopPane.add(borrow);        borrow.setSize(desktopPane.getWidth(), desktopPane.getHeight());        borrow.setVisible(true);        borrow.setLocation(0,0);    }//GEN-LAST:event_jm_BookBorrowActionPerformed    private void jm_tjActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jm_tjActionPerformed        if(login==null||            login.getLoginOK()==false)            {            this.desktopPane.add(login);            login.setSize(400,250);            login.setVisible(true);            login.setLocation((desktopPane.getWidth()-400)/2,(desktopPane.getHeight()-250)/2);            return;            }        Stat stat=new Stat(dc);        this.desktopPane.add(stat);        stat.setSize(desktopPane.getWidth(), desktopPane.getHeight());        stat.setVisible(true);        stat.setLocation(0,0);    }//GEN-LAST:event_jm_tjActionPerformed    private void aboutMenuItemActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_aboutMenuItemActionPerformed        javax.swing.JOptionPane.showMessageDialog(this,            "本软件为免费软件,请放心使用。\n" +            "本软件可应用于各类图书馆。\n" +            "编写人:赵夏、刘勇、易军臣、倪少春、郑涛");    }//GEN-LAST:event_aboutMenuItemActionPerformed    private void jmi_BookDAActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jmi_BookDAActionPerformed        if(login==null||            login.getLoginOK()==false)            {            this.desktopPane.add(login);            login.setSize(400,250);            login.setVisible(true);            login.setLocation((desktopPane.getWidth()-400)/2,(desktopPane.getHeight()-25)/2);            return;            }        Book book=new Book(dc);        this.desktopPane.add(book);        book.setSize(this.desktopPane.getWidth(),         this.desktopPane.getHeight());               book.setVisible(true) ;        book.setLocation(0,0);    }//GEN-LAST:event_jmi_BookDAActionPerformed    private void jmi_BookDAMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jmi_BookDAMouseClicked    }//GEN-LAST:event_jmi_BookDAMouseClicked    private void jmi_SortDAActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jmi_SortDAActionPerformed        //类别档案        if(login==null||            login.getLoginOK()==false)            {            this.desktopPane.add(login);            login.setSize(400,250);            login.setVisible(true);            login.setLocation((desktopPane.getWidth()-400)/2,(desktopPane.getHeight()-250)/2);            return;            }        Sort sort=new Sort(dc);        this.desktopPane.add(sort);        sort.setSize(this.desktopPane.getWidth(),             this.desktopPane.getHeight());        sort.setVisible(true);        sort.setLocation(0,0);    }//GEN-LAST:event_jmi_SortDAActionPerformed            /**     * @param args the command line arguments     */    public static void main(String args[]) {        new MdiMain().show();        MdiMain mdi=new MdiMain();        java.awt.Dimension screenSize =            java.awt.Toolkit.getDefaultToolkit().getScreenSize();        mdi.setSize(screenSize.width, screenSize.height);        mdi.setLocation(0,0);        mdi.setVisible(true);        mdi.show();        mdi.goLogin();    }        // 变量声明 - 不进行修改//GEN-BEGIN:variables    private javax.swing.JMenuItem aboutMenuItem;    private javax.swing.JDesktopPane desktopPane;    private javax.swing.JMenu helpMenu;    private javax.swing.JMenuItem jm_BookBorrow;    private javax.swing.JMenu jm_da;    private javax.swing.JMenu jm_jh;    private javax.swing.JMenu jm_login;    private javax.swing.JMenuItem jm_quit;    private javax.swing.JMenuItem jm_return;    private javax.swing.JMenu jm_table;    private javax.swing.JMenuItem jm_tj;    private javax.swing.JMenuItem jmi_BookDA;    private javax.swing.JMenuItem jmi_SortDA;    private javax.swing.JMenuItem jmi_login;    private javax.swing.JMenuBar menuBar;    // 变量声明结束//GEN-END:variables    }

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -