随便看看

/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */


/*
 * SelectiveMainFrame.java
 *
 * Created on 2014-7-8, 10:04:34
 */
package com.gs.stu.view;


import com.gs.stu.bean.*;
import com.gs.stu.util.FrameUtil;
import com.gs.stu.util.LocationUtil;
import java.beans.PropertyVetoException;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.swing.JInternalFrame;


/**
 *
 * @author Administrator
 */
public class SelectiveMainFrame extends javax.swing.JFrame {
public static Manager manager;
public static Teacher teacher;
public static Student student;
    /** Creates new form SelectiveMainFrame */
    public SelectiveMainFrame() {
        initComponents();
        LocationUtil.setFullScreen(this);
        if(manager!=null)
        {
            this.setTitle("学生选课系统   "+manager.getSysaccount()+",欢迎您!");
            teacherMenu.setEnabled(false);
            studentMenu.setEnabled(false);
        }
        if(teacher!=null)
        {
            this.setTitle("学生选课系统   "+teacher.getTname()+",欢迎您!");
            managerMenu.setEnabled(false);
            studentMenu.setEnabled(false);
        }
        if(student!=null)
        {
            this.setTitle("学生选课系统   "+student.getSname()+",欢迎您!");
            teacherMenu.setEnabled(false);
            managerMenu.setEnabled(false);
        }
    }


    /** This method is called from within the constructor to
     * initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is
     * always regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // //GEN-BEGIN:initComponents
    private void initComponents() {


        mainDesktopPane1 = new com.gs.stu.view.MainDesktopPane();
        jMenuBar1 = new javax.swing.JMenuBar();
        managerMenu = new javax.swing.JMenu();
        managerMenuItem = new javax.swing.JMenuItem();
        departmentMenuItem = new javax.swing.JMenuItem();
        classMenuItem = new javax.swing.JMenuItem();
        teacherMenuItem = new javax.swing.JMenuItem();
        courseMenuItem = new javax.swing.JMenuItem();
        studentMenuItem = new javax.swing.JMenuItem();
        logMenuItem = new javax.swing.JMenuItem();
        teacherMenu = new javax.swing.JMenu();
        updateTpwdMenuItem = new javax.swing.JMenuItem();
        queryTeachMenuItem = new javax.swing.JMenuItem();
        querySelectMenuItem = new javax.swing.JMenuItem();
        ScoreMenuItem = new javax.swing.JMenuItem();
        studentMenu = new javax.swing.JMenu();
        updateSpwdMenuItem = new javax.swing.JMenuItem();
        selectCourseMenuItem = new javax.swing.JMenuItem();
        PersonalSelectMenuItem = new javax.swing.JMenuItem();
        queryScoreMenuItem = new javax.swing.JMenuItem();


        setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
        setTitle("学生选课系统");


        managerMenu.setText("管理员");


        managerMenuItem.setText("管理员管理");
        managerMenuItem.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                managerMenuItemActionPerformed(evt);
            }
        });
        managerMenu.add(managerMenuItem);


        departmentMenuItem.setText("系部管理");
        departmentMenuItem.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                departmentMenuItemActionPerformed(evt);
            }
        });
        managerMenu.add(departmentMenuItem);


        classMenuItem.setText("班级管理");
        classMenuItem.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                classMenuItemActionPerformed(evt);
            }
        });
        managerMenu.add(classMenuItem);


        teacherMenuItem.setText("教师管理");
        teacherMenuItem.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                teacherMenuItemActionPerformed(evt);
            }
        });
        managerMenu.add(teacherMenuItem);


        courseMenuItem.setText("课程管理");
        courseMenuItem.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                courseMenuItemActionPerformed(evt);
            }
        });
        managerMenu.add(courseMenuItem);


        studentMenuItem.setText("学生管理");
        studentMenuItem.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                studentMenuItemActionPerformed(evt);
            }
        });
        managerMenu.add(studentMenuItem);


        logMenuItem.setText("日志管理");
        logMenuItem.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                logMenuItemActionPerformed(evt);
            }
        });
        managerMenu.add(logMenuItem);


        jMenuBar1.add(managerMenu);


        teacherMenu.setText("教师");


        updateTpwdMenuItem.setText("修改密码");
        updateTpwdMenuItem.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                updateTpwdMenuItemActionPerformed(evt);
            }
        });
        teacherMenu.add(updateTpwdMenuItem);


        queryTeachMenuItem.setText("查看任课信息");
        queryTeachMenuItem.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                queryTeachMenuItemActionPerformed(evt);
            }
        });
        teacherMenu.add(queryTeachMenuItem);


        querySelectMenuItem.setText("查看选课信息");
        querySelectMenuItem.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                querySelectMenuItemActionPerformed(evt);
            }
        });
        teacherMenu.add(querySelectMenuItem);


        ScoreMenuItem.setText("成绩管理");
        ScoreMenuItem.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                ScoreMenuItemActionPerformed(evt);
            }
        });
        teacherMenu.add(ScoreMenuItem);


        jMenuBar1.add(teacherMenu);


        studentMenu.setText("学生");


        updateSpwdMenuItem.setText("修改密码");
        updateSpwdMenuItem.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                updateSpwdMenuItemActionPerformed(evt);
            }
        });
        studentMenu.add(updateSpwdMenuItem);


        selectCourseMenuItem.setText("选课");
        selectCourseMenuItem.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                selectCourseMenuItemActionPerformed(evt);
            }
        });
        studentMenu.add(selectCourseMenuItem);


        PersonalSelectMenuItem.setText("个人选课信息");
        PersonalSelectMenuItem.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                PersonalSelectMenuItemActionPerformed(evt);
            }
        });
        studentMenu.add(PersonalSelectMenuItem);


        queryScoreMenuItem.setText("成绩查询");
        queryScoreMenuItem.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                queryScoreMenuItemActionPerformed(evt);
            }
        });
        studentMenu.add(queryScoreMenuItem);


        jMenuBar1.add(studentMenu);


        setJMenuBar(jMenuBar1);


        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
        getContentPane().setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addComponent(mainDesktopPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 495, Short.MAX_VALUE)
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addComponent(mainDesktopPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 358, Short.MAX_VALUE)
        );


        pack();
    }//
//GEN-END:initComponents


private void managerMenuItemActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_managerMenuItemActionPerformed


    showFrame("managerframe");
}//GEN-LAST:event_managerMenuItemActionPerformed


private void departmentMenuItemActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_departmentMenuItemActionPerformed


    showFrame("departmentframe");
}//GEN-LAST:event_departmentMenuItemActionPerformed


private void classMenuItemActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_classMenuItemActionPerformed


   showFrame("classframe");
    
}//GEN-LAST:event_classMenuItemActionPerformed


private void teacherMenuItemActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_teacherMenuItemActionPerformed


    showFrame("teacherframe");
}//GEN-LAST:event_teacherMenuItemActionPerformed


private void courseMenuItemActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_courseMenuItemActionPerformed
// TODO add your handling code here
    showFrame("courseframe");
}//GEN-LAST:event_courseMenuItemActionPerformed


private void studentMenuItemActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_studentMenuItemActionPerformed
    showFrame("studentframe"); 
}//GEN-LAST:event_studentMenuItemActionPerformed


private void logMenuItemActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_logMenuItemActionPerformed


    showFrame("logframe");
}//GEN-LAST:event_logMenuItemActionPerformed


private void updateTpwdMenuItemActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_updateTpwdMenuItemActionPerformed
    showFrame("teaupdatepwdframe");
}//GEN-LAST:event_updateTpwdMenuItemActionPerformed


private void queryTeachMenuItemActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_queryTeachMenuItemActionPerformed
    showFrame("teasearchteachframe");
}//GEN-LAST:event_queryTeachMenuItemActionPerformed


private void querySelectMenuItemActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_querySelectMenuItemActionPerformed
    showFrame("teasearchselectframe");
}//GEN-LAST:event_querySelectMenuItemActionPerformed


private void ScoreMenuItemActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_ScoreMenuItemActionPerformed
    showFrame("teascoreframe");
}//GEN-LAST:event_ScoreMenuItemActionPerformed


private void updateSpwdMenuItemActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_updateSpwdMenuItemActionPerformed
    showFrame("stuspdateswdsrame");
}//GEN-LAST:event_updateSpwdMenuItemActionPerformed


private void selectCourseMenuItemActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_selectCourseMenuItemActionPerformed
    showFrame("stuselectcourseframe");
}//GEN-LAST:event_selectCourseMenuItemActionPerformed


private void PersonalSelectMenuItemActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_PersonalSelectMenuItemActionPerformed
    showFrame("stusearchselfselectframe");
}//GEN-LAST:event_PersonalSelectMenuItemActionPerformed


private void queryScoreMenuItemActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_queryScoreMenuItemActionPerformed
    showFrame("stusearchscoresframe");
}//GEN-LAST:event_queryScoreMenuItemActionPerformed


    /**
     * @param args the command line arguments
     */
    public static void main(String args[]) {
        /* Set the Nimbus look and feel */
        //
        /* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel.
         * For details see http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html 
         */
        try {
            for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) {
                if ("Nimbus".equals(info.getName())) {
                    javax.swing.UIManager.setLookAndFeel(info.getClassName());
                    break;
                }
            }
        } catch (ClassNotFoundException ex) {
            java.util.logging.Logger.getLogger(SelectiveMainFrame.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        } catch (InstantiationException ex) {
            java.util.logging.Logger.getLogger(SelectiveMainFrame.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        } catch (IllegalAccessException ex) {
            java.util.logging.Logger.getLogger(SelectiveMainFrame.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        } catch (javax.swing.UnsupportedLookAndFeelException ex) {
            java.util.logging.Logger.getLogger(SelectiveMainFrame.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        }
        //



        /* Create and display the form */
        java.awt.EventQueue.invokeLater(new Runnable() {


            public void run() {
                new SelectiveMainFrame().setVisible(true);
            }
        });
    }
    private void showFrame(String frameName)
{
    JInternalFrame internalFrame=FrameUtil.buildInternalFrame(frameName);
    mainDesktopPane1.remove(internalFrame);
    mainDesktopPane1.add(internalFrame);
    LocationUtil.setParentCenter(this,internalFrame);
    internalFrame.setVisible(true);
    internalFrame.toFront();//最前
        try {
            internalFrame.setSelected(true);
        } catch (PropertyVetoException ex) {
            Logger.getLogger(SelectiveMainFrame.class.getName()).log(Level.SEVERE, null, ex);
        }
}
    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JMenuItem PersonalSelectMenuItem;
    private javax.swing.JMenuItem ScoreMenuItem;
    private javax.swing.JMenuItem classMenuItem;
    private javax.swing.JMenuItem courseMenuItem;
    private javax.swing.JMenuItem departmentMenuItem;
    private javax.swing.JMenuBar jMenuBar1;
    private javax.swing.JMenuItem logMenuItem;
    private com.gs.stu.view.MainDesktopPane mainDesktopPane1;
    private javax.swing.JMenu managerMenu;
    private javax.swing.JMenuItem managerMenuItem;
    private javax.swing.JMenuItem queryScoreMenuItem;
    private javax.swing.JMenuItem querySelectMenuItem;
    private javax.swing.JMenuItem queryTeachMenuItem;
    private javax.swing.JMenuItem selectCourseMenuItem;
    private javax.swing.JMenu studentMenu;
    private javax.swing.JMenuItem studentMenuItem;
    private javax.swing.JMenu teacherMenu;
    private javax.swing.JMenuItem teacherMenuItem;
    private javax.swing.JMenuItem updateSpwdMenuItem;
    private javax.swing.JMenuItem updateTpwdMenuItem;
    // End of variables declaration//GEN-END:variables
}

你可能感兴趣的:(编码)