Netbeans - How to assign ChartPanel to a JPanel

A discussion forum for JFreeChart (a 2D chart library for the Java platform).

Netbeans - How to assign ChartPanel to a JPanel

Postby Jim McGlaughlin » Tue Jul 25, 2006 9:26 pm

In the Netbeans UI design mode I have created a JPanel that I would like to be the panel for my chart.

The examples show the ChartPanel assigned as setContentPane() and it becomes the whole JFrame.

How do I setup one of the many JPanels in my JFrame to be the ChartPanel instead of making it the content pane of the JFrame.

Jim McGlaughlin
Posts: 26
Joined: Tue Jul 25, 2006 9:16 pm
Location: Newburyport, MA USA

Postby david.gilbert » Wed Jul 26, 2006 2:53 pm

You could add the ChartPanel to a JPanel that has a BorderLayout. But that is a little bit wasteful, since the ChartPanel is a JComponent that can occupy the same spot as any other you can just put the ChartPanel anywhere you can put a JPanel.

One thing to note: the ChartPanel class is not currently a JavaBean, so you won't be able to manipulate it with a GUI designer tool. I'm going to have a play with NetBeans and see what is involved with fixing that...although I don't expect it to be easy.
David Gilbert
JFreeChart Project Leader

:idea: Read my blog
:idea: Ask your company to buy the JFreeChart Developer Guide
:idea: Check out other products sold by my company Object Refinery Limited
JFreeChart Project Leader
Posts: 11664
Joined: Fri Mar 14, 2003 10:29 am

Return to JFreeChart

Who is online

Users browsing this forum: No registered users and 18 guests