Java下拉框监听,加入界面,切换界面的处理

该代码实现了一个Java图形用户界面,包含下拉菜单选项,用户可选择查看不同类型的诊断分值图表,如雷达图、柱状图和饼图,用于展示学生在英语学习中的各项能力评估。
摘要由CSDN通过智能技术生成

java--GUI--下拉框组件_jframe下拉框_两年半的JAVA练习生的博客-CSDN博客

package PredictedScore;

import org.knowm.xchart.SwingWrapper;
import org.knowm.xchart.XChartPanel;
import org.knowm.xchart.XYChart;

import javax.swing.*;
import java.awt.*;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;

public class Text {

    static final int WIDTH = 1000;
    static final int HEIGHT = 800;

    
    static JFrame frame =new JFrame("用户画像");

    public static void text() {


        frame.setFont(Util.fontTitle);
        frame.setSize(WIDTH, HEIGHT);
        frame.setVisible(true);
        frame.setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE);
        JMenuBar menuBar=new JMenuBar();



        menuBar.add(Util.menu1());
        menuBar.add(Util.menu2());
        menuBar.add(Util.menu3());
        menuBar.add(Util.menu4());
        menuBar.add(Util.menu5());
        menuBar.add(Util.menu6());

        frame.setJMenuBar(menuBar);



    }
    public static void main(String[] args) {
        SwingUtilities.invokeLater(Text::text);

    }

}


package PredictedScore;

import org.knowm.xchart.*;
import org.knowm.xchart.internal.chartpart.Chart;

import javax.swing.*;
import java.awt.*;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;

public class Util {

    static final int WIDTH = 1000;
    static final int HEIGHT = 800;

    static Font fontTitle  = new Font("宋体",Font.BOLD,18);
    static Font  font  = new Font("宋体",Font.PLAIN,18);
    static Font  fontBig  = new Font("宋体",Font.PLAIN,20);

    static JPanel  temPanel;
    public static JMenu menu1(){

        JMenu menu=new JMenu("诊断分值");
        menu.setFont(font);
        JMenuItem menuItem1=new JMenuItem("学生试题类型诊断分值图");
        JMenuItem menuItem2=new JMenuItem("学生阅读理解知识点诊断分值图");
        JMenuItem menuItem3=new JMenuItem("学生作文写作知识点诊断分值图");
        JMenuItem menuItem4=new JMenuItem("学生短文翻译知识点诊断分值图");

        menuItem1.addActionListener(new ActionListener() {
            public void actionPerformed(ActionEvent e) {
                RadarChart chart = RadarChart01.getChart();
                JPanel chartPanel =  new XChartPanel<RadarChart>(chart);
                if(temPanel != null){
                    Text.frame.remove(temPanel);
                }
                temPanel = chartPanel;
                Text.frame.add(chartPanel);
                Text.frame.setVisible(true);
                System.out.println("学生试题类型诊断分值图");
            }
        });

        menuItem2.addActionListener(new ActionListener() {
            public void actionPerformed(ActionEvent e) {
                RadarChart chart = RadarChart02.getChart();
                JPanel chartPanel =  new XChartPanel<RadarChart>(chart);
                if(temPanel != null){
                    Text.frame.remove(temPanel);
                }
                temPanel = chartPanel;
                Text.frame.add(chartPanel);
                Text.frame.setVisible(true);
                System.out.println("学生阅读理解知识点诊断分值图");
            }
        });

        menuItem4.addActionListener(new ActionListener() {
            public void actionPerformed(ActionEvent e) {
                RadarChart chart = RadarChart04.getChart();

                JPanel chartPanel =  new XChartPanel<RadarChart>(chart);
                if(temPanel != null){
                    Text.frame.remove(temPanel);
                }
                temPanel = chartPanel;
                Text.frame.add(chartPanel);
                Text.frame.setVisible(true);
                System.out.println("学生短文翻译知识点诊断分值图");
            }
        });

        menuItem3.addActionListener(new ActionListener() {
            public void actionPerformed(ActionEvent e) {
                RadarChart chart = RadarChart03.getChart();

                JPanel chartPanel =  new XChartPanel<RadarChart>(chart);
                if(temPanel != null){
                    Text.frame.remove(temPanel);
                }
                temPanel = chartPanel;
                Text.frame.add(chartPanel);
                Text.frame.setVisible(true);
                System.out.println("学生作文写作知识点诊断分值图");
            }
        });

        menuItem1.setFont(font);
        menuItem2.setFont(font);
        menuItem3.setFont(font);
        menuItem4.setFont(font);
        menu.add(menuItem1);
        menu.add(menuItem2);
        menu.add(menuItem3);
        menu.add(menuItem4);

        return  menu;
    }


    public static JMenu menu4(){

        JMenu menu=new JMenu("完形填空");
        menu.setFont(font);

        JMenuItem menuItem1=new JMenuItem("学生一学期内四级完形填空(词汇知识点)答题情况图");
        JMenuItem menuItem2=new JMenuItem("学生一学期内五级完形填空(词汇知识点)答题情况图");

        menuItem1.addActionListener(new ActionListener() {
            public void actionPerformed(ActionEvent e) {
                CategoryChart chart = TestForIssue62.getHistogramChartByLevelFour("学生一学期内四级完形填空(词汇知识点)答题情况图");
//        new SwingWrapper<>(chart).displayChart();
                JPanel chartPanel = new XChartPanel<CategoryChart>(chart);
                if(temPanel != null){
                    Text.frame.remove(temPanel);
                }
                temPanel = chartPanel;
                Text.frame.add(chartPanel);
                Text.frame.setVisible(true);
                System.out.println("学生一学期内四级完形填空(词汇知识点)答题情况图");
            }
        });

        menuItem2.addActionListener(new ActionListener() {
            public void actionPerformed(ActionEvent e) {
                CategoryChart chart = TestForIssue62.getHistogramChartByLevelFive("学生一学期内五级完形填空(词汇知识点)答题情况图");
//        new SwingWrapper<>(chart).displayChart();
                JPanel chartPanel = new XChartPanel<CategoryChart>(chart);
                if(temPanel != null){
                    Text.frame.remove(temPanel);
                }
                temPanel = chartPanel;
                Text.frame.add(chartPanel);
                Text.frame.setVisible(true);
                System.out.println("学生一学期内五级完形填空(词汇知识点)答题情况图");
            }
        });

        menuItem1.setFont(font);
        menuItem2.setFont(font);

        menu.add(menuItem1);
        menu.add(menuItem2);

        return  menu;
    }

    public static JMenu menu2(){

        JMenu menu=new JMenu("数量分布");
        menu.setFont(font);

        JMenuItem menuItem1=new JMenuItem("学生一个学期内答题类型数量分布图");
        JMenuItem menuItem2=new JMenuItem("学生一个学期内答题等级数量分布图");

        menuItem1.addActionListener(new ActionListener() {
            public void actionPerformed(ActionEvent e) {
                PieChart chart = TestForIssue1.getChart();
//        new SwingWrapper<>(chart).displayChart();
                JPanel chartPanel = new XChartPanel<PieChart>(chart);
                if(temPanel != null){
                    Text.frame.remove(temPanel);
                }
                temPanel = chartPanel;
                Text.frame.add(chartPanel);
                Text.frame.setVisible(true);
                System.out.println("学生一个学期内答题类型数量分布图");
            }
        });

        menuItem2.addActionListener(new ActionListener() {
            public void actionPerformed(ActionEvent e) {
                PieChart chart = TestForIssue2.getChart();
//        new SwingWrapper<>(chart).displayChart();
                JPanel chartPanel = new XChartPanel<PieChart>(chart);
                if(temPanel != null){
                    Text.frame.remove(temPanel);
                }
                temPanel = chartPanel;
                Text.frame.add(chartPanel);
                Text.frame.setVisible(true);
                System.out.println("学生一个学期内答题等级数量分布图");
            }
        });

        menuItem1.setFont(font);
        menuItem2.setFont(font);

        menu.add(menuItem1);
        menu.add(menuItem2);

        return  menu;
    }


    public static JMenu menu3(){
        JMenu menu=new JMenu("阅读理解");
        JMenu menu1=new JMenu("阅读理解总览");
        JMenu menu2=new JMenu("四级阅读理解知识点");
        JMenu menu3=new JMenu("五级阅读理解知识点");
        menu.setFont(font);
        menu1.setFont(font);
        menu2.setFont(font);
        menu3.setFont(font);

        JMenuItem menuItem1=new JMenuItem("学生一学期内四级阅读理解答题情况图");
        JMenuItem menuItem2=new JMenuItem("学生一学期内五级阅读理解答题情况图");
        menu1.add(menuItem1);
        menu1.add(menuItem2);

        menuItem1.addActionListener(new ActionListener() {
            public void actionPerformed(ActionEvent e) {
                PieChart chart = TestForIssue21.getChart();
//        new SwingWrapper<>(chart).displayChart();
                JPanel chartPanel = new XChartPanel<PieChart>(chart);
                if(temPanel != null){
                    Text.frame.remove(temPanel);
                }
                temPanel = chartPanel;
                Text.frame.add(chartPanel);
                Text.frame.setVisible(true);
                System.out.println("学生一学期内四级阅读理解答题情况图");

            }
        });

        menuItem2.addActionListener(new ActionListener() {
            public void actionPerformed(ActionEvent e) {
                PieChart chart = TestForIssue22.getChart();
//        new SwingWrapper<>(chart).displayChart();
                JPanel chartPanel = new XChartPanel<PieChart>(chart);
                if(temPanel != null){
                    Text.frame.remove(temPanel);
                }
                temPanel = chartPanel;
                Text.frame.add(chartPanel);
                Text.frame.setVisible(true);
                System.out.println("学生一学期内五级阅读理解答题情况图");

            }
        });


        JMenuItem menuItem3=new JMenuItem("学生一学期内四级阅读理解(态度知识点)答题情况图");
        JMenuItem menuItem4=new JMenuItem("学生一学期内四级阅读理解(主旨知识点)答题情况图");
        JMenuItem menuItem5=new JMenuItem("学生一学期内四级阅读理解(词汇知识点)答题情况图");
        JMenuItem menuItem6=new JMenuItem("学生一学期内四级阅读理解(细节知识点)答题情况图");
        JMenuItem menuItem7=new JMenuItem("学生一学期内四级阅读理解(同义转述知识点)答题情况图");
        JMenuItem menuItem8=new JMenuItem("学生一学期内四级阅读理解(推理知识点)答题情况图");
        menu2.add(menuItem3);
        menu2.add(menuItem4);
        menu2.add(menuItem5);
        menu2.add(menuItem6);
        menu2.add(menuItem7);
        menu2.add(menuItem8);
        menuItem3.addActionListener(new ActionListener() {
            public void actionPerformed(ActionEvent e) {
                CategoryChart chart = TestForIssue61.getHistogramChartByLevelFour("学生一学期内四级阅读理解(态度知识点)答题情况图");
                JPanel chartPanel = new XChartPanel<CategoryChart>(chart);
                if(temPanel != null){
                    Text.frame.remove(temPanel);
                }
                temPanel = chartPanel;
                Text.frame.add(chartPanel);
                Text.frame.setVisible(true);
                System.out.println("学生一学期内四级阅读理解(态度知识点)答题情况图");
            }
        });
        menuItem4.addActionListener(new ActionListener() {
            public void actionPerformed(ActionEvent e) {
                CategoryChart chart = TestForIssue61.getHistogramChartByLevelFour("学生一学期内四级阅读理解(主旨知识点)答题情况图");
                JPanel chartPanel = new XChartPanel<CategoryChart>(chart);
                if(temPanel != null){
                    Text.frame.remove(temPanel);
                }
                temPanel = chartPanel;
                Text.frame.add(chartPanel);
                Text.frame.setVisible(true);
                System.out.println("学生一学期内四级阅读理解(主旨知识点)答题情况图");
            }
        });
        menuItem5.addActionListener(new ActionListener() {
            public void actionPerformed(ActionEvent e) {
                CategoryChart chart = TestForIssue61.getHistogramChartByLevelFour("学生一学期内四级阅读理解(词汇知识点)答题情况图");
                JPanel chartPanel = new XChartPanel<CategoryChart>(chart);
                if(temPanel != null){
                    Text.frame.remove(temPanel);
                }
                temPanel = chartPanel;
                Text.frame.add(chartPanel);
                Text.frame.setVisible(true);
                System.out.println("学生一学期内四级阅读理解(词汇知识点)答题情况图");
            }
        });
        menuItem6.addActionListener(new ActionListener() {
            public void actionPerformed(ActionEvent e) {
                CategoryChart chart = TestForIssue61.getHistogramChartByLevelFour("学生一学期内四级阅读理解(细节知识点)答题情况图");
                JPanel chartPanel = new XChartPanel<CategoryChart>(chart);
                if(temPanel != null){
                    Text.frame.remove(temPanel);
                }
                temPanel = chartPanel;
                Text.frame.add(chartPanel);
                Text.frame.setVisible(true);
                System.out.println("学生一学期内四级阅读理解(细节知识点)答题情况图");
            }
        });
        menuItem7.addActionListener(new ActionListener() {
            public void actionPerformed(ActionEvent e) {
                CategoryChart chart = TestForIssue61.getHistogramChartByLevelFour("学生一学期内四级阅读理解(同义转述知识点)答题情况图");
                JPanel chartPanel = new XChartPanel<CategoryChart>(chart);
                if(temPanel != null){
                    Text.frame.remove(temPanel);
                }
                temPanel = chartPanel;
                Text.frame.add(chartPanel);
                Text.frame.setVisible(true);
                System.out.println("学生一学期内四级阅读理解(同义转述知识点)答题情况图");
            }
        });
        menuItem8.addActionListener(new ActionListener() {
            public void actionPerformed(ActionEvent e) {
                CategoryChart chart = TestForIssue61.getHistogramChartByLevelFour("学生一学期内四级阅读理解(推理知识点)答题情况图");
                JPanel chartPanel = new XChartPanel<CategoryChart>(chart);
                if(temPanel != null){
                    Text.frame.remove(temPanel);
                }
                temPanel = chartPanel;
                Text.frame.add(chartPanel);
                Text.frame.setVisible(true);
                System.out.println("学生一学期内四级阅读理解(推理知识点)答题情况图");
            }
        });

        JMenuItem menuItem9=new JMenuItem("学生一学期内五级阅读理解(态度知识点)答题情况图");
        JMenuItem menuItem10=new JMenuItem("学生一学期内五级阅读理解(主旨知识点)答题情况图");
        JMenuItem menuItem11=new JMenuItem("学生一学期内五级阅读理解(词汇知识点)答题情况图");
        JMenuItem menuItem12=new JMenuItem("学生一学期内五级阅读理解(细节知识点)答题情况图");
        JMenuItem menuItem13=new JMenuItem("学生一学期内五级阅读理解(同义转述知识点)答题情况图");
        JMenuItem menuItem14=new JMenuItem("学生一学期内五级阅读理解(推理知识点)答题情况图");
        menu3.add(menuItem9);
        menu3.add(menuItem10);
        menu3.add(menuItem11);
        menu3.add(menuItem12);
        menu3.add(menuItem13);
        menu3.add(menuItem14);

        menuItem9.addActionListener(new ActionListener() {
            public void actionPerformed(ActionEvent e) {
                CategoryChart chart = TestForIssue61.getHistogramChartByLevelFive("学生一学期内五级阅读理解(态度知识点)答题情况图");
                JPanel chartPanel = new XChartPanel<CategoryChart>(chart);
                if(temPanel != null){
                    Text.frame.remove(temPanel);
                }
                temPanel = chartPanel;
                Text.frame.add(chartPanel);
                Text.frame.setVisible(true);
                System.out.println("学生一学期内五级阅读理解(态度知识点)答题情况图");
            }
        });
        menuItem10.addActionListener(new ActionListener() {
            public void actionPerformed(ActionEvent e) {
                CategoryChart chart = TestForIssue61.getHistogramChartByLevelFour("学生一学期内五级阅读理解(主旨知识点)答题情况图");
                JPanel chartPanel = new XChartPanel<CategoryChart>(chart);
                if(temPanel != null){
                    Text.frame.remove(temPanel);
                }
                temPanel = chartPanel;
                Text.frame.add(chartPanel);
                Text.frame.setVisible(true);
                System.out.println("学生一学期内五级阅读理解(主旨知识点)答题情况图");
            }
        });
        menuItem11.addActionListener(new ActionListener() {
            public void actionPerformed(ActionEvent e) {
                CategoryChart chart = TestForIssue61.getHistogramChartByLevelFour("学生一学期内五级阅读理解(词汇知识点)答题情况图");
                JPanel chartPanel = new XChartPanel<CategoryChart>(chart);
                if(temPanel != null){
                    Text.frame.remove(temPanel);
                }
                temPanel = chartPanel;
                Text.frame.add(chartPanel);
                Text.frame.setVisible(true);
                System.out.println("学生一学期内五级阅读理解(词汇知识点)答题情况图");
            }
        });
        menuItem12.addActionListener(new ActionListener() {
            public void actionPerformed(ActionEvent e) {
                CategoryChart chart = TestForIssue61.getHistogramChartByLevelFour("学生一学期内五级阅读理解(细节知识点)答题情况图");
                JPanel chartPanel = new XChartPanel<CategoryChart>(chart);
                if(temPanel != null){
                    Text.frame.remove(temPanel);
                }
                temPanel = chartPanel;
                Text.frame.add(chartPanel);
                Text.frame.setVisible(true);
                System.out.println("学生一学期内五级阅读理解(细节知识点)答题情况图");
            }
        });
        menuItem13.addActionListener(new ActionListener() {
            public void actionPerformed(ActionEvent e) {
                CategoryChart chart = TestForIssue61.getHistogramChartByLevelFour("学生一学期内五级阅读理解(同义转述知识点)答题情况图");
                JPanel chartPanel = new XChartPanel<CategoryChart>(chart);
                if(temPanel != null){
                    Text.frame.remove(temPanel);
                }
                temPanel = chartPanel;
                Text.frame.add(chartPanel);
                Text.frame.setVisible(true);
                System.out.println("学生一学期内五级阅读理解(同义转述知识点)答题情况图");
            }
        });
        menuItem14.addActionListener(new ActionListener() {
            public void actionPerformed(ActionEvent e) {
                CategoryChart chart = TestForIssue61.getHistogramChartByLevelFour("学生一学期内五级阅读理解(推理知识点)答题情况图");
                JPanel chartPanel = new XChartPanel<CategoryChart>(chart);
                if(temPanel != null){
                    Text.frame.remove(temPanel);
                }
                temPanel = chartPanel;
                Text.frame.add(chartPanel);
                Text.frame.setVisible(true);
                System.out.println("学生一学期内五级阅读理解(推理知识点)答题情况图");
            }
        });

        menuItem1.setFont(font);
        menuItem2.setFont(font);
        menuItem3.setFont(font);
        menuItem4.setFont(font);
        menuItem5.setFont(font);
        menuItem6.setFont(font);
        menuItem7.setFont(font);
        menuItem8.setFont(font);
        menuItem9.setFont(font);
        menuItem10.setFont(font);
        menuItem11.setFont(font);
        menuItem12.setFont(font);
        menuItem13.setFont(font);
        menuItem14.setFont(font);


        menu.add(menu1);
        menu.add(menu2);
        menu.add(menu3);

        return  menu;
    }


    public static JMenu menu5(){
        JMenu menu=new JMenu("作文写作");
        JMenu menu1=new JMenu("一学期内四级作文写作");
        JMenu menu2=new JMenu("一学期内五级作文写作");
        JMenu menu3=new JMenu("一月内四级作文写作");
        JMenu menu4=new JMenu("一月内五级作文写作");
        menu.setFont(font);
        menu1.setFont(font);
        menu2.setFont(font);
        menu3.setFont(font);
        menu4.setFont(font);


        JMenuItem menuItem1=new JMenuItem("学生一学期内四级作文写作各知识点平均分值情况图");
        JMenuItem menuItem2=new JMenuItem("学生一学期内五级作文写作各知识点平均分值情况图");
        menu1.add(menuItem1);
        menu2.add(menuItem2);
        menuItem1.addActionListener(new ActionListener() {
            public void actionPerformed(ActionEvent e) {
                XYChart chart = DateChart04.getChart("学生一学期内四级作文写作各知识点平均分值情况图");
//        new SwingWrapper<>(chart).displayChart();
                JPanel chartPanel = new XChartPanel<XYChart>(chart);
                if(temPanel != null){
                    Text.frame.remove(temPanel);
                }
                temPanel = chartPanel;
                Text.frame.add(chartPanel);
                Text.frame.setVisible(true);
                System.out.println("学生一学期内四级作文写作各知识点平均分值情况图");
            }
        });
        menuItem2.addActionListener(new ActionListener() {
            public void actionPerformed(ActionEvent e) {
                XYChart chart = DateChart04.getChart("学生一学期内五级作文写作各知识点平均分值情况图");
//        new SwingWrapper<>(chart).displayChart();
                JPanel chartPanel = new XChartPanel<XYChart>(chart);
                if(temPanel != null){
                    Text.frame.remove(temPanel);
                }
                temPanel = chartPanel;
                Text.frame.add(chartPanel);
                Text.frame.setVisible(true);
                System.out.println("学生一学期内五级作文写作各知识点平均分值情况图");
            }
        });


        JMenuItem menuItem3=new JMenuItem("学生三月份四级作文写作各知识点分值情况图");
        JMenuItem menuItem4=new JMenuItem("学生四月份四级作文写作各知识点分值情况图");
        JMenuItem menuItem5=new JMenuItem("学生五月份四级作文写作各知识点分值情况图");
        JMenuItem menuItem6=new JMenuItem("学生六月份四级作文写作各知识点分值情况图");
        menu3.add(menuItem3);
        menu3.add(menuItem4);
        menu3.add(menuItem5);
        menu3.add(menuItem6);
        menuItem3.addActionListener(new ActionListener() {
            public void actionPerformed(ActionEvent e) {
                XYChart chart = DateChart03.getChart("学生三月份四级作文写作各知识点分值情况图");
//        new SwingWrapper<>(chart).displayChart();
                JPanel chartPanel = new XChartPanel<XYChart>(chart);
                if(temPanel != null){
                    Text.frame.remove(temPanel);
                }
                temPanel = chartPanel;
                Text.frame.add(chartPanel);
                Text.frame.setVisible(true);
                System.out.println("学生三月份四级作文写作各知识点分值情况图");
            }
        });

        menuItem4.addActionListener(new ActionListener() {
            public void actionPerformed(ActionEvent e) {
                XYChart chart = DateChart03.getChart("学生四月份四级作文写作各知识点分值情况图");
//        new SwingWrapper<>(chart).displayChart();
                JPanel chartPanel = new XChartPanel<XYChart>(chart);
                if(temPanel != null){
                    Text.frame.remove(temPanel);
                }
                temPanel = chartPanel;
                Text.frame.add(chartPanel);
                Text.frame.setVisible(true);
                System.out.println("学生四月份四级作文写作各知识点分值情况图");
            }
        });

        menuItem5.addActionListener(new ActionListener() {
            public void actionPerformed(ActionEvent e) {
                XYChart chart = DateChart03.getChart("学生五月份四级作文写作各知识点分值情况图");
//        new SwingWrapper<>(chart).displayChart();
                JPanel chartPanel = new XChartPanel<XYChart>(chart);
                if(temPanel != null){
                    Text.frame.remove(temPanel);
                }
                temPanel = chartPanel;
                Text.frame.add(chartPanel);
                Text.frame.setVisible(true);
                System.out.println("学生五月份四级作文写作各知识点分值情况图");
            }
        });

        menuItem6.addActionListener(new ActionListener() {
            public void actionPerformed(ActionEvent e) {
                XYChart chart = DateChart03.getChart("学生六月份四级作文写作各知识点分值情况图");
//        new SwingWrapper<>(chart).displayChart();
                JPanel chartPanel = new XChartPanel<XYChart>(chart);
                if(temPanel != null){
                    Text.frame.remove(temPanel);
                }
                temPanel = chartPanel;
                Text.frame.add(chartPanel);
                Text.frame.setVisible(true);
                System.out.println("学生六月份四级作文写作各知识点分值情况图");
            }
        });


        JMenuItem menuItem9=new JMenuItem("学生三月份五级作文写作各知识点分值情况图");
        JMenuItem menuItem10=new JMenuItem("学生四月份五级作文写作各知识点分值情况图");
        JMenuItem menuItem11=new JMenuItem("学生五月份五级作文写作各知识点分值情况图");
        JMenuItem menuItem12=new JMenuItem("学生六月份五级作文写作各知识点分值情况图");
        menu4.add(menuItem9);
        menu4.add(menuItem10);
        menu4.add(menuItem11);
        menu4.add(menuItem12);
        menuItem9.addActionListener(new ActionListener() {
            public void actionPerformed(ActionEvent e) {
                XYChart chart = DateChart03.getChart("学生三月份五级作文写作各知识点分值情况图");
//        new SwingWrapper<>(chart).displayChart();
                JPanel chartPanel = new XChartPanel<XYChart>(chart);
                if(temPanel != null){
                    Text.frame.remove(temPanel);
                }
                temPanel = chartPanel;
                Text.frame.add(chartPanel);
                Text.frame.setVisible(true);
                System.out.println("学生三月份五级作文写作各知识点分值情况图");
            }
        });

        menuItem10.addActionListener(new ActionListener() {
            public void actionPerformed(ActionEvent e) {
                XYChart chart = DateChart03.getChart("学生四月份五级作文写作各知识点分值情况图");
//        new SwingWrapper<>(chart).displayChart();
                JPanel chartPanel = new XChartPanel<XYChart>(chart);
                if(temPanel != null){
                    Text.frame.remove(temPanel);
                }
                temPanel = chartPanel;
                Text.frame.add(chartPanel);
                Text.frame.setVisible(true);
                System.out.println("学生四月份五级作文写作各知识点分值情况图");
            }
        });

        menuItem11.addActionListener(new ActionListener() {
            public void actionPerformed(ActionEvent e) {
                XYChart chart = DateChart03.getChart("学生五月份五级作文写作各知识点分值情况图");
//        new SwingWrapper<>(chart).displayChart();
                JPanel chartPanel = new XChartPanel<XYChart>(chart);
                if(temPanel != null){
                    Text.frame.remove(temPanel);
                }
                temPanel = chartPanel;
                Text.frame.add(chartPanel);
                Text.frame.setVisible(true);
                System.out.println("学生五月份五级作文写作各知识点分值情况图");
            }
        });

        menuItem12.addActionListener(new ActionListener() {
            public void actionPerformed(ActionEvent e) {
                XYChart chart = DateChart03.getChart("学生六月份五级作文写作各知识点分值情况图");
//        new SwingWrapper<>(chart).displayChart();
                JPanel chartPanel = new XChartPanel<XYChart>(chart);
                if(temPanel != null){
                    Text.frame.remove(temPanel);
                }
                temPanel = chartPanel;
                Text.frame.add(chartPanel);
                Text.frame.setVisible(true);
                System.out.println("学生六月份五级作文写作各知识点分值情况图");
            }
        });

        menuItem1.setFont(font);
        menuItem2.setFont(font);
        menuItem3.setFont(font);
        menuItem4.setFont(font);
        menuItem5.setFont(font);
        menuItem6.setFont(font);

        menuItem9.setFont(font);
        menuItem10.setFont(font);
        menuItem11.setFont(font);
        menuItem12.setFont(font);



        menu.add(menu1);
        menu.add(menu2);
        menu.add(menu3);
        menu.add(menu4);
        return  menu;
    }

    public static JMenu menu6(){
        JMenu menu=new JMenu("短文翻译");
        JMenu menu1=new JMenu("一学期内四级短文翻译");
        JMenu menu2=new JMenu("一学期内五级短文翻译");
        JMenu menu3=new JMenu("一月内四级短文翻译");
        JMenu menu4=new JMenu("一月内五级短文翻译");
        menu.setFont(font);
        menu1.setFont(font);
        menu2.setFont(font);
        menu3.setFont(font);
        menu4.setFont(font);

        JMenuItem menuItem1=new JMenuItem("学生一学期内四级短文翻译各知识点平均分值情况图");
        JMenuItem menuItem2=new JMenuItem("学生一学期内五级短文翻译各知识点平均分值情况图");
        menu1.add(menuItem1);
        menu2.add(menuItem2);

        menuItem1.addActionListener(new ActionListener() {
            public void actionPerformed(ActionEvent e) {
                XYChart chart = DateChart04.getChart("学生一学期内四级短文翻译各知识点平均分值情况图");
//        new SwingWrapper<>(chart).displayChart();
                JPanel chartPanel = new XChartPanel<XYChart>(chart);
                if(temPanel != null){
                    Text.frame.remove(temPanel);
                }
                temPanel = chartPanel;
                Text.frame.add(chartPanel);
                Text.frame.setVisible(true);
                System.out.println("学生一学期内四级短文翻译各知识点平均分值情况图");
            }
        });
        menuItem2.addActionListener(new ActionListener() {
            public void actionPerformed(ActionEvent e) {
                XYChart chart = DateChart04.getChart("学生一学期内五级短文翻译各知识点平均分值情况图");
//        new SwingWrapper<>(chart).displayChart();
                JPanel chartPanel = new XChartPanel<XYChart>(chart);
                if(temPanel != null){
                    Text.frame.remove(temPanel);
                }
                temPanel = chartPanel;
                Text.frame.add(chartPanel);
                Text.frame.setVisible(true);
                System.out.println("学生一学期内五级短文翻译各知识点平均分值情况图");
            }
        });

        JMenuItem menuItem3=new JMenuItem("学生三月份四级短文翻译各知识点分值情况图");
        JMenuItem menuItem4=new JMenuItem("学生四月份四级短文翻译各知识点分值情况图");
        JMenuItem menuItem5=new JMenuItem("学生五月份四级短文翻译各知识点分值情况图");
        JMenuItem menuItem6=new JMenuItem("学生六月份四级短文翻译各知识点分值情况图");
        menu3.add(menuItem3);
        menu3.add(menuItem4);
        menu3.add(menuItem5);
        menu3.add(menuItem6);
        menuItem3.addActionListener(new ActionListener() {
            public void actionPerformed(ActionEvent e) {
                XYChart chart = DateChart03.getChart("学生三月份四级短文翻译各知识点分值情况图");
//        new SwingWrapper<>(chart).displayChart();
                JPanel chartPanel = new XChartPanel<XYChart>(chart);
                if(temPanel != null){
                    Text.frame.remove(temPanel);
                }
                temPanel = chartPanel;
                Text.frame.add(chartPanel);
                Text.frame.setVisible(true);
                System.out.println("学生三月份四级短文翻译各知识点分值情况图");
            }
        });

        menuItem4.addActionListener(new ActionListener() {
            public void actionPerformed(ActionEvent e) {
                XYChart chart = DateChart03.getChart("学生四月份四级短文翻译各知识点分值情况图");
//        new SwingWrapper<>(chart).displayChart();
                JPanel chartPanel = new XChartPanel<XYChart>(chart);
                if(temPanel != null){
                    Text.frame.remove(temPanel);
                }
                temPanel = chartPanel;
                Text.frame.add(chartPanel);
                Text.frame.setVisible(true);
                System.out.println("学生四月份四级短文翻译各知识点分值情况图");
            }
        });

        menuItem5.addActionListener(new ActionListener() {
            public void actionPerformed(ActionEvent e) {
                XYChart chart = DateChart03.getChart("学生五月份四级短文翻译各知识点分值情况图");
//        new SwingWrapper<>(chart).displayChart();
                JPanel chartPanel = new XChartPanel<XYChart>(chart);
                if(temPanel != null){
                    Text.frame.remove(temPanel);
                }
                temPanel = chartPanel;
                Text.frame.add(chartPanel);
                Text.frame.setVisible(true);
                System.out.println("学生五月份四级短文翻译各知识点分值情况图");
            }
        });

        menuItem6.addActionListener(new ActionListener() {
            public void actionPerformed(ActionEvent e) {
                XYChart chart = DateChart03.getChart("学生六月份四级短文翻译各知识点分值情况图");
//        new SwingWrapper<>(chart).displayChart();
                JPanel chartPanel = new XChartPanel<XYChart>(chart);
                if(temPanel != null){
                    Text.frame.remove(temPanel);
                }
                temPanel = chartPanel;
                Text.frame.add(chartPanel);
                Text.frame.setVisible(true);
                System.out.println("学生六月份四级短文翻译各知识点分值情况图");
            }
        });


        JMenuItem menuItem9=new JMenuItem("学生三月份五级短文翻译各知识点分值情况图");
        JMenuItem menuItem10=new JMenuItem("学生四月份五级短文翻译各知识点分值情况图");
        JMenuItem menuItem11=new JMenuItem("学生五月份五级短文翻译各知识点分值情况图");
        JMenuItem menuItem12=new JMenuItem("学生六月份五级短文翻译各知识点分值情况图");
        menu4.add(menuItem9);
        menu4.add(menuItem10);
        menu4.add(menuItem11);
        menu4.add(menuItem12);


        menuItem9.addActionListener(new ActionListener() {
            public void actionPerformed(ActionEvent e) {
                XYChart chart = DateChart03.getChart("学生三月份五级短文翻译各知识点分值情况图");
//        new SwingWrapper<>(chart).displayChart();
                JPanel chartPanel = new XChartPanel<XYChart>(chart);
                if(temPanel != null){
                    Text.frame.remove(temPanel);
                }
                temPanel = chartPanel;
                Text.frame.add(chartPanel);
                Text.frame.setVisible(true);
                System.out.println("学生三月份五级短文翻译各知识点分值情况图");
            }
        });

        menuItem10.addActionListener(new ActionListener() {
            public void actionPerformed(ActionEvent e) {
                XYChart chart = DateChart03.getChart("学生四月份五级短文翻译各知识点分值情况图");
//        new SwingWrapper<>(chart).displayChart();
                JPanel chartPanel = new XChartPanel<XYChart>(chart);
                if(temPanel != null){
                    Text.frame.remove(temPanel);
                }
                temPanel = chartPanel;
                Text.frame.add(chartPanel);
                Text.frame.setVisible(true);
                System.out.println("学生四月份五级短文翻译各知识点分值情况图");
            }
        });

        menuItem11.addActionListener(new ActionListener() {
            public void actionPerformed(ActionEvent e) {
                XYChart chart = DateChart03.getChart("学生五月份五级短文翻译各知识点分值情况图");
//        new SwingWrapper<>(chart).displayChart();
                JPanel chartPanel = new XChartPanel<XYChart>(chart);
                if(temPanel != null){
                    Text.frame.remove(temPanel);
                }
                temPanel = chartPanel;
                Text.frame.add(chartPanel);
                Text.frame.setVisible(true);
                System.out.println("学生五月份五级短文翻译各知识点分值情况图");
            }
        });

        menuItem12.addActionListener(new ActionListener() {
            public void actionPerformed(ActionEvent e) {
                XYChart chart = DateChart03.getChart("学生六月份五级短文翻译各知识点分值情况图");
//        new SwingWrapper<>(chart).displayChart();
                JPanel chartPanel = new XChartPanel<XYChart>(chart);
                if(temPanel != null){
                    Text.frame.remove(temPanel);
                }
                temPanel = chartPanel;
                Text.frame.add(chartPanel);
                Text.frame.setVisible(true);
                System.out.println("学生六月份五级短文翻译各知识点分值情况图");
            }
        });

        menuItem1.setFont(font);
        menuItem2.setFont(font);
        menuItem3.setFont(font);
        menuItem4.setFont(font);
        menuItem5.setFont(font);
        menuItem6.setFont(font);

        menuItem9.setFont(font);
        menuItem10.setFont(font);
        menuItem11.setFont(font);
        menuItem12.setFont(font);



        menu.add(menu1);
        menu.add(menu2);
        menu.add(menu3);
        menu.add(menu4);
        return  menu;
    }
}

  • 0
    点赞
  • 3
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值