Añadir un JPanel en un JFrame

Tengo definido un JPanel, en el que tengo una grafica con el componente CharPanel, y esto añadido a un JFrame con esta linea:

Código:
this.add(new Graficador());

Aparentemente está en el JFrame, pero cuando modifico el tamaño de la ventana, el panel con la gráfica no modifica su tamaño. Por más vueltas que le doy no consigo añadirlo bién.

El código del JPanel es este:

Código:
import org.jfree.chart.ChartFactory;
import org.jfree.chart.ChartPanel;
import org.jfree.chart.JFreeChart;
import org.jfree.chart.plot.PlotOrientation;
import org.jfree.data.xy.XYDataset;
import org.jfree.data.xy.XYSeries;
import org.jfree.data.xy.XYSeriesCollection;

import java.awt.Dimension;

import javax.swing.JPanel;
 
public class Graficador extends JPanel
{
	public JFreeChart chart1;
	ChartPanel panel1;
	public static XYSeries datos = new XYSeries("Linea Funcion");
	
    public Graficador()
    {
        XYDataset paresDeDatos = generarDatos();
        chart1 = crearDiagrama(paresDeDatos);
        this.panel1 = new ChartPanel( chart1 );
        this.add( panel1 , java.awt.BorderLayout.WEST);
        panel1.setPreferredSize(new Dimension(780,700));
    }
 
    public XYDataset generarDatos()
    {
        XYSeriesCollection conjuntoDatos = new XYSeriesCollection();
        //datos.add(0,0);
        conjuntoDatos.addSeries(datos);
 
        return conjuntoDatos;
    }
    
    public JFreeChart crearDiagrama(XYDataset conjuntoDatos)
    {
    	chart1 = ChartFactory.createXYLineChart(
                                "GRAFICA DEL ESPECTRO EN VOLT/Hz", //Titulo Grafica
                                "X", // Leyenda eje X
                                "Y", // Leyenda eje Y
                                conjuntoDatos, // Los datos
                                PlotOrientation.VERTICAL, //orientacion
                                false, // ver titulo de linea
                                false, //tooltips
                                true  //URL
        );
        return chart1;
    }
 }

1 abrazo.
 
Atrás
Arriba