InternalFrame chart

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

InternalFrame chart

Post by William Hidden » Mon Mar 18, 2002 5:07 pm

Hi Dave,

I would like say great charting framework. In my application I had need for a
JFreeChartInternalFrame. Here is my quick solution by changing the inheritance from JFrame to JInternalFrame. I have not done extensive testing to catch any of the idiosyncrasies between a JFrame and a JInternalFrame so user beware.

<FILE JFreeChartInternalFrame.java\>
/* =======================================
* JFreeChart : a Java Chart Class Library
* =======================================
*
* Project Info: http://www.jrefinery.com/jfreechart;
* Project Lead: David Gilbert (david.gilbert@jrefinery.com);
*
* (C) Copyright 2000-2002, by Simba Management Limited and Contributors.
*
* This library is free software; you can redistribute it and/or modify it under the terms
* of the GNU Lesser General Public License as published by the Free Software Foundation;
* either version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
* See the GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License along with this
* library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330,
* Boston, MA 02111-1307, USA.
*
* --------------------
* JFreeChartInternalFrame.java
* --------------------
* (C) Copyright 2001, 2002, by Simba Management Limited and Contributors.
*
* Original Author: David Gilbert (for Simba Management Limited);
* Contributor(s): -;
*
* $Id: JFreeChartInternalFrame.java,v 1.1.2.1 2002/03/08 13:55:16 bill Exp $
*
* Changes
* -------
* 22-Nov-2001 : Version 1 (DG);
* 08-Jan-2001 : Added chartPanel attribute (DG);
* 08-Mar-2002 : changed inheritance from JFrame to JInternalFrame (WTH);
*/

package com.jrefinery.chart;

import java.awt.event.*;
import javax.swing.*;

/**
* A frame for displaying a chart.
*/
public class JFreeChartInternalFrame extends JInternalFrame {

/** The chart panel. */
protected JFreeChartPanel chartPanel;

/**
* Constructs an internal frame for a chart.
* @param title The frame title.
* @param chart The chart.
*/
public JFreeChartInternalFrame(String title, JFreeChart chart) {
this(title, chart, false);
}

/**
* Constructs an internal frame for a chart.
* @param title The frame title.
* @param chart The chart.
*/
public JFreeChartInternalFrame(String title, JFreeChart chart, boolean scrollPane) {

super(title);
chartPanel = new JFreeChartPanel(chart);
if (scrollPane) {
this.setContentPane(new JScrollPane(chartPanel));
}
else this.setContentPane(chartPanel);
this.setResizable(true);
}

/**
* Returns the chart panel for the frame.
* @return The chart panel for the frame.
*/
public JFreeChartPanel getChartPanel() {
return this.chartPanel;
}

}

David Gilbert

Re: InternalFrame chart

Post by David Gilbert » Mon Mar 18, 2002 6:20 pm

Hi William,

Thanks! I don't use JInternalFrame myself, but I'll include your class in the next release of JFreeChart for those that do...

Regards,

DG.

Mudit Wahal

Re: InternalFrame chart

Post by Mudit Wahal » Sun Apr 21, 2002 5:48 pm

William,

Can you please show one example where you are using JFreeChartInternalFrame ?

I've been trying to build a MDI application using JInternalFrame but unsuccessful so far.

Thanks
Mudit

Locked