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

📄 mainwindow.java

📁 用Java做的一个学生考试分析程序
💻 JAVA
📖 第 1 页 / 共 3 页
字号:
        jRadioButtonMenuItemMotif.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jRadioButtonMenuItemMotif(evt);
            }
        });

        jMenu2.add(jRadioButtonMenuItemMotif);

        jRadioButtonMenuItemWindows.setSelected(true);
        jRadioButtonMenuItemWindows.setText("Windows");
        jRadioButtonMenuItemWindows.setToolTipText("\u89c6\u7a97\u98ce\u683c");
        jRadioButtonMenuItemWindows.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jRadioButtonMenuItemWindows(evt);
            }
        });

        jMenu2.add(jRadioButtonMenuItemWindows);

        jMenu2.add(jSeparator4);

        jMenuBar1.add(jMenu2);

        jMenu3.setText("\u7cfb\u7edf\u6587\u4ef6");
        jMenu3.add(jSeparator5);

        jMenuItemStudent.setText("\u5b66\u751f\u6587\u4ef6");
        jMenuItemStudent.setToolTipText("\u7cfb\u7edf\u4e2d\u8bb0\u5f55\u7684\u5b66\u751f\u4fe1\u606f");
        jMenuItemStudent.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jMenuItemStudentActionListener(evt);
            }
        });

        jMenu3.add(jMenuItemStudent);

        jMenuItemCourse.setText("\u8bfe\u7a0b\u6587\u4ef6");
        jMenuItemCourse.setToolTipText("\u7cfb\u7edf\u4e2d\u8bb0\u5f55\u7684\u8bfe\u7a0b\u4fe1\u606f");
        jMenuItemCourse.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jMenuItemCourseActionListener(evt);
            }
        });

        jMenu3.add(jMenuItemCourse);

        jMenuItemClass.setText("\u73ed\u7ea7\u6587\u4ef6");
        jMenuItemClass.setToolTipText("\u7cfb\u7edf\u4e2d\u8bb0\u5f55\u7684\u73ed\u7ea7\u4fe1\u606f");
        jMenuItemClass.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jMenuItemClassActionListener(evt);
            }
        });

        jMenu3.add(jMenuItemClass);

        jMenuItemScoreMenu.setText("\u6210\u7ee9\u5355\u6587\u4ef6");
        jMenuItemScoreMenu.setToolTipText("\u7cfb\u7edf\u4e2d\u8bb0\u5f55\u7684\u6210\u7ee9\u5355\u4fe1\u606f");
        jMenuItemScoreMenu.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jMenuItemScoreMenuActionListener(evt);
            }
        });

        jMenu3.add(jMenuItemScoreMenu);

        jMenu3.add(jSeparator6);

        jMenuBar1.add(jMenu3);

        jMenu4.setText("\u9009\u9879");
        jMenu4.add(jSeparator7);

        jMenuItemAboutSystem.setText("\u5173\u4e8e\u7cfb\u7edf");
        jMenuItemAboutSystem.setToolTipText("\u7b80\u4ecb\u7cfb\u7edf\u7684\u529f\u80fd");
        jMenuItemAboutSystem.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jMenuItemAboutSystemActionListener(evt);
            }
        });

        jMenu4.add(jMenuItemAboutSystem);

        jMenuItemAboutAuthor.setText("\u5173\u4e8e\u4f5c\u8005");
        jMenuItemAboutAuthor.setToolTipText("\u4ecb\u7ecd\u4f5c\u8005\u7684\u57fa\u672c\u4fe1\u606f");
        jMenuItemAboutAuthor.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jMenuItemAboutAuthorActionListener(evt);
            }
        });

        jMenu4.add(jMenuItemAboutAuthor);

        jMenu4.add(jSeparator8);

        jMenuBar1.add(jMenu4);

        jMenu5.setText("\u5f53\u524d\u65f6\u95f4");
        jMenuCurrentTime.setText("\u663e\u793a\u5f53\u524d\u65f6\u95f4");
        jMenuCurrentTime.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jMenuCurrentTimeActionListener(evt);
            }
        });

        jMenu5.add(jMenuCurrentTime);

        jMenuBar1.add(jMenu5);

        setJMenuBar(jMenuBar1);

        org.jdesktop.layout.GroupLayout layout = new org.jdesktop.layout.GroupLayout(getContentPane());
        getContentPane().setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
            .add(layout.createSequentialGroup()
                .addContainerGap()
                .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
                    .add(org.jdesktop.layout.GroupLayout.TRAILING, jToolBarQuery, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 613, Short.MAX_VALUE)
                    .add(org.jdesktop.layout.GroupLayout.TRAILING, jToolBarMenu, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 613, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
                    .add(jToolBarAdd, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 603, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
                    .add(jToolBarScoreAnasys, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 603, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))
                .addContainerGap())
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
            .add(layout.createSequentialGroup()
                .addContainerGap()
                .add(jToolBarMenu, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 40, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
                .add(25, 25, 25)
                .add(jToolBarQuery, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 37, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
                .add(12, 12, 12)
                .add(jToolBarAdd, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 26, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
                .add(15, 15, 15)
                .add(jToolBarScoreAnasys, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 30, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
                .add(245, 245, 245))
        );
        pack();
    }// </editor-fold>//GEN-END:initComponents
    public void myInit(){        
        initDataFile(Student.STUDENT_FILE);
        initDataFile(Class.CLASS_FILE);
        initDataFile(Course.COURSE_FILE);
        initDataFile(ScoreMenu.SCORE_MENU_FILE);
        remove(jToolBarMenu);
        remove(jToolBarQuery);
        remove(jToolBarAdd);
        remove(jToolBarScoreAnasys);
        JPanel jpanel=new JPanel(new BorderLayout());
        jpanel.add(jToolBarMenu,BorderLayout.SOUTH);
        jpanel.add(contentPanel,BorderLayout.CENTER);
        setLayout(new BorderLayout());
        getContentPane().add(jpanel,BorderLayout.CENTER);
    }
    private void jMenuCurrentTimeActionListener(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jMenuCurrentTimeActionListener
        CurrentTime time=new CurrentTime("当前时间");
        time.setSize(520,400);
        time.setVisible(true);
    }//GEN-LAST:event_jMenuCurrentTimeActionListener

    private void jMenuItemAboutAuthorActionListener(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jMenuItemAboutAuthorActionListener
        String text="指导老师:肖磊\n作者:张文龙\n年级:2005级\n专业班级:计算机科学与技术3班\n邮箱:zhang_wen_long@126.com";
        JOptionPane.showMessageDialog(null,text,"关于作者",JOptionPane.WARNING_MESSAGE);
    }//GEN-LAST:event_jMenuItemAboutAuthorActionListener

    private void jMenuItemAboutSystemActionListener(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jMenuItemAboutSystemActionListener
        String text="系统可以分为三大操作模块:\n查询模块,增加模块,成绩分析模块\n每个模块里面包括学生操作,班级操作," +
                "课程操作,成绩单操作\n用户可以通过窗口最下面的工具栏选择相应模块\n在每个模块里面选择相应功能\n";
        JOptionPane.showMessageDialog(null,text,"关于系统",JOptionPane.WARNING_MESSAGE);
    }//GEN-LAST:event_jMenuItemAboutSystemActionListener

    private void jMenuItemExitActionListener(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jMenuItemExitActionListener
        int select=JOptionPane.showConfirmDialog(null,"确定退出系统","确定",JOptionPane.OK_CANCEL_OPTION);
        if(select==0)
            System.exit(0);
    }//GEN-LAST:event_jMenuItemExitActionListener

    private void windowClosingListener(java.awt.event.WindowEvent evt) {//GEN-FIRST:event_windowClosingListener
        int select=JOptionPane.showConfirmDialog(null,"确定退出系统","确定",JOptionPane.OK_CANCEL_OPTION);
        if(select==0)
            System.exit(0);
    }//GEN-LAST:event_windowClosingListener
    public static void initDataFile(String fileName){
        File file=new File(fileName);
        try{
            if(!file.exists())
                file.createNewFile();
        }catch(Exception e){}
    }

    private void jRadioButtonMenuItemWindows(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jRadioButtonMenuItemWindows
        try{
            UIManager.setLookAndFeel(new com.sun.java.swing.plaf.windows.WindowsLookAndFeel());
        }catch(Exception e){
            System.out.println("设置失败");
        }
    }//GEN-LAST:event_jRadioButtonMenuItemWindows

    private void jRadioButtonMenuItemMotif(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jRadioButtonMenuItemMotif
        try{
            UIManager.setLookAndFeel(new com.sun.java.swing.plaf.motif.MotifLookAndFeel());
        }catch(Exception e){
            System.out.println("设置失败");
        }
    }//GEN-LAST:event_jRadioButtonMenuItemMotif

    private void jRadioButtonMenuItemMetal(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jRadioButtonMenuItemMetal
        try{
            UIManager.setLookAndFeel(UIManager.getCrossPlatformLookAndFeelClassName());
        }catch(Exception e){
            System.out.println("设置失败");
        }
    }//GEN-LAST:event_jRadioButtonMenuItemMetal

    private void jMenuItemScoreMenuActionListener(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jMenuItemScoreMenuActionListener
        ScoreMenu[] scoreMenu=ScoreMenu.loadFile();
        Class tempClass;
        Course course;
        int[] testTime;
        int number;
        long[] id;
        float[] score;
        int count=0;
        for(int i=0;i<scoreMenu.length;i++)
            if(scoreMenu[i]!=null)
                count++;
        String text="成绩单信息文件中总共有"+count+"个成绩单,具体如下:\n";
        for(int i=0;i<count;i++){
            tempClass=scoreMenu[i].getClassOfScoreMenu();
            course=scoreMenu[i].getCourse();
            testTime=scoreMenu[i].getTestTime();

⌨️ 快捷键说明

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