I added a .removeAll button. It works fine clearing the .add(label) from the panel but the chart still does not appear. BTW, repeatedly adding the label simply wrote on top of the existing label.
The Panel's preferred size is set to width 600 height 400, large enough for the chart to be noticed.
The code that I borrowed from the demo included a PreferredSize line: chartpanel.setPreferredSize(new java.awt.Dimension(300, 400)); I have tried with and without this code.
This prompted me to wonder if a swing JPanel was different from an AWT Panel. So, I tried adding an AWT Panel (with .add and from the Design window). Interestingly, the .add(Panel) works, but the chart still does not appear (nor did it appear when I added the panel manually in the design window).
The previous posts sound like this is supposed to work pretty easily. So, I guess I will try it in Eclipse or NetBeans 6.0. I will post a question to the NetBeans forum and ask about problems with .add to jpanels and see what they say. Thanks for the suggestions. Any additional ideas are appreciated.
Display JFreeChart inside a panel
ChartPanel does not appear in JFrame
hey guys I found out what was my problem. Propably it's not the same problem like has harrierpark but I will explain it anyway.
my problem was I used design editor in netbeans. And there is used some strange layout manager, and also for JPanel where I want display JFree chart (I really don't understand to this designer
) And it doesn't work. Anyway solution is easy, set for JPanel new layout manager, for example:
jPanel1.setLayout(new FlowLayout());
and then
jPanel1.add(chartPanel); //jPanel1 is JPanel class
jPanel1.updateUI(); //chartPanel is ChartPanel class
and it's work fine.
This is my 5 cent's to this topic
my problem was I used design editor in netbeans. And there is used some strange layout manager, and also for JPanel where I want display JFree chart (I really don't understand to this designer

jPanel1.setLayout(new FlowLayout());
and then
jPanel1.add(chartPanel); //jPanel1 is JPanel class
jPanel1.updateUI(); //chartPanel is ChartPanel class
and it's work fine.
This is my 5 cent's to this topic

To make my char display in a existing panel I created a panel via NetBeans palete. Named it jScatterChartPanel. Right clicked the new panel and set layout to "Border Layout". Then used the following code.
jScatterChartPanel.add(JfreeChartScattergram.createChartPanel());
JfreeChartScattergram is the class that generated the chart.
The key here is Border Layout for the panel displaying the chart.
>gr<
jScatterChartPanel.add(JfreeChartScattergram.createChartPanel());
JfreeChartScattergram is the class that generated the chart.
The key here is Border Layout for the panel displaying the chart.
>gr<
>gr<