Setting Background color for ChartPanel??

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

Setting Background color for ChartPanel??

Post by Kishore » Thu Oct 31, 2002 2:59 pm

Hi,
Thanks.now i am able to achieve what i asked for.i.e keeping a Close button and action for that.
now i have three panels.
one is main panel which containing ChartPanel and the Otherpanel containg only close buttion aligned using BirderLayout. fine.
The problem here is i am not able to set the Background colotr the ChartPanel. i used
panel.setBackground(java.awt.Color.GREEN);
panel.setOpaque(false);//True is bydefalut..i.e also not working..

is there a Catch for this.Plz lemme know if someone come across the similar Problem in the Past.

Thx,
Kishore.

Dave Gilbert

Re: Setting Background color for ChartPanel??

Post by Dave Gilbert » Fri Nov 01, 2002 10:00 am

The panel color doesn't show because the chart fills the entire panel. So you need to look at the setBackgroundPaint(...) method in the JFreeChart class.

Regards,

DG.

P.S. If someone knows how to make the default background color for the chart equal to the default background color for a panel, can you let me know? Here's what I currently use:

public static final Paint DEFAULT_BACKGROUND_PAINT = SystemColor.control;

This doesn't work for me on Linux (it is a different shade of grey compared to the controls I see). Can someone tell me what it looks like in Windows?

Locked