Need a "chart.getLegend().setFramePaint( Paint )" !!!

A discussion forum for JFreeChart (a 2D chart library for the Java platform).
Locked
roonghu
Posts: 3
Joined: Thu Mar 04, 2010 9:36 pm
antibot: No, of course not.

Need a "chart.getLegend().setFramePaint( Paint )" !!!

Post by roonghu » Thu Mar 04, 2010 9:47 pm

I am trying to use JFreeChart and generate a legend frame/box colored outline.
Since the following usage has deprecated,
chart.getLegend().setOutlinePaint(new Color(255,0,0));

I tried to use

plot.getRenderer().setBaseOutlinePaint(Color.red);

However, nothing changed. Can anyone tell me how to do that?
It is really inconvenient that any BlockBorder or BlockFrame in JFreeChart is only having "getPaint()" method, without "setPaint( Paint)" method.

Can it be implemented?

Thanks!

roonghu

roonghu
Posts: 3
Joined: Thu Mar 04, 2010 9:36 pm
antibot: No, of course not.

Re: Need a "chart.getLegend().setFramePaint( Paint )" !!!

Post by roonghu » Thu Mar 04, 2010 9:50 pm

BTW, I just do not understand why all the BlockBorder and BlockFrame class are not providing any "setPaint( Paint )" methods.
Is it difficult to do so?

remiohead
Posts: 201
Joined: Fri Oct 02, 2009 3:53 pm
antibot: No, of course not.

Re: Need a "chart.getLegend().setFramePaint( Paint )" !!!

Post by remiohead » Fri Mar 05, 2010 2:19 pm

If you read the documentation (crazy I know) you'll see that BlockBorder is immutable, thus has no set methods at all.

The solution is to make use of a constructor that takes Paint as an argument:

Code: Select all

public BlockBorder(Paint paint) 

public BlockBorder(double top, double left, double bottom, double right, Paint paint)

Locked