Bug?--Null legend crashes ChartPropertyEditPanel

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

Bug?--Null legend crashes ChartPropertyEditPanel

Post by Jonathan Nash » Sun Jul 29, 2001 10:05 pm

Calling ChartPropertyEditPanel with a null legend (an allowed feature) causes it to crap out. This is very simple to fix. I've solved the problem as follows by creating an identical class with the following 2 changes:

in the constructor put the 3 legend lines in the following if:

if (legend != null) {
legendPropertiesPanel = new LegendPropertyEditPanel(legend);
legendPropertiesPanel.setBorder(BorderFactory.createEmptyBorder(2, 2, 2, 2));
tabs.addTab("Legend", legendPropertiesPanel);
}

and setChartProperties put the legend line in the following if:

if (chart.getLegend() != null) {
legendPropertiesPanel.setLegendProperties(chart.getLegend());
}

Do you want such reports posted to this board or to the sourceforge support tracker?

Keep up the good work. JFreeChart is excellent.

David Gilbert

RE: Bug?--Null legend crashes ChartPropertyEditPan

Post by David Gilbert » Mon Jul 30, 2001 9:15 pm

Hi Jonathan,

Thanks for your posting - I'll get the fix added to the code asap.

Regards,

DG

Locked