我需要将此折线图与我的JFrame相同,而不是同时打开JFrame和折线图
setLayout(new BorderLayout());
setSize(600, 100);
setBounds(600, 450, 800, 200);
//(950, 300, 500, 500);
setTitle("Main Menu");
//data set for graph
DefaultCategoryDataset dataset = new DefaultCategoryDataset();
dataset.setValue(8, "", "");
dataset.setValue(6, "", "");
JFreeChart chart = ChartFactory.createLineChart("Chart Name", "X axis name", "Y axis name", dataset);
setTitle("Main Menu");
ChartFrame frame = new ChartFrame("Window name", chart);
frame.setVisible(true);
frame.setBounds(400, 300, 500, 500);
setResizable(false);
setVisible(true);
setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE);