使用netbeans gui編輯器和im試圖添加一個Jfreechart本身在一個內部框架和這個內部框架我想將它添加到面板,你可以在此圖像中看到(抱歉,我不能上傳圖像直接因爲我是新手):如何在NetBeans中添加Jfreechart(餅圖)到面板
http://www.flickr.com/photos/[email protected]/6370734167/
內部框架甚至不露面的面板「Estadisticas」當我運行它,我認爲它很難,因爲我沒有通過代碼來完成gui,但它不應該那麼難,如果任何人都可以幫助我正確地添加它,我將不勝感激,以下是我一直在嘗試的代碼:
private void display() {
DefaultPieDataset pieDataset = new DefaultPieDataset();
pieDataset.setValue("One", new Integer(10));
pieDataset.setValue("Two", new Integer(20));
pieDataset.setValue("Three", new Integer(30));
pieDataset.setValue("Four", new Integer(10));
pieDataset.setValue("Five", new Integer(20));
pieDataset.setValue("Six", new Integer(10));
JFreeChart chart = ChartFactory.createPieChart3D(
"3D Pie Chart", pieDataset, true, true, true);
ChartPanel cp = new ChartPanel(chart);
// JInternalFrame jif = new JInternalFrame(
// "Chart", true, true, true, true);
this.ji.add(cp); //ji is the name of the internal frame
this.ji.pack();
this.ji.setVisible(true);
this.ji.setSize(100, 100);
JDesktopPane dtp = new JDesktopPane();
dtp.add(ji);
this.jpEstadisticas.add(dtp); //jpEstadisticas the name of the main "Estadisticas"panel
}
爲什麼不簡單地手工添加它呢? –