我想将JFreeChart添加到JPanel ,然后将JPanel添加到JTabbedPane 。 我设法在JFrame上显示JFreeChart ,但我想添加JFreeChart作为JTabbedPane的第4个选项卡。 代码显示图表: public class Chart extends javax.swing.JPanel { private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) { JPanel jPanel1 = new JPanel(); DefaultCategoryDataset dataset = new DefaultCategoryDataset(); dataset.setValue(60, "Marks", "Student 1"); dataset.setValue(40, "Marks", "Student 2"); dataset.setValue(90, "Marks", "Student 3"); dataset.setValue(50, "Marks", "Student 4"); dataset.setValue(70, "Marks", "Student 5"); dataset.setValue(30, "Marks", "Student 6"); JFreeChart chart = ChartFactory.createBarChart( […]