I am having trouble programmatically adding (panel.add) objects to a JPanel in NetBeans 6.1. The problem surfaced attempting to add JFreeChart to a JPanel. To isolate the problem I created a Frame with 3 panels (header, left, main). In the left panel I added several buttons.
The first button creates the chart and displays it in a new Frame (ChartFrame) separate from my defined Frame. This works fine, so we know the chart is created.
The second button .add-s a Label to the jPanelMain. This also works fine (although attempting to .add a JLabel does NOT work.) So, the event logic apparently is capable of adding to the panel.
The 3rd button creates the chart and attempts to .add the chart to the jPanelMain. This does NOT work. The chart does not display in the panel, nor does it display in a separate Frame.
Here are a few (of many) things I’ve tried:
1. Attempting to move the ChartFrame to the panel does not work (not really expected to work.)
2. Adding an AWT Panel – The chart does not display. It does not matter if the panel is predefined or added (.add) in the program.
To test if it was possible to add other objects to the panel I tried adding a Button and a CheckBox; neither was added. The only object successfully added is a Label. The panel.removeAll() also works.
Summary, I am having trouble .add-ing objects to a JPanel (or Panel) within NetBeans 6.1. There should be a simple solution. Your help understanding the solution is appreciated.

