llamar clase y pasar datos

neoh quin
12 de Mayo del 2011
buenas tardes tengo un inconveniente le he dado vueltas y vueltas y nada que puedo
tengo una clase menu que es donde llama todos los metodos y tengo la clase regresion lineal que es la siguiente

package estadistica;

import java.awt.*;
import javax.swing.JPanel;
import javax.swing.JTabbedPane;
import org.jfree.chart.ChartPanel;
import org.jfree.chart.JFreeChart;
import org.jfree.chart.axis.NumberAxis;
import org.jfree.chart.plot.XYPlot;
import org.jfree.chart.renderer.xy.XYLineAndShapeRenderer;
import org.jfree.data.function.LineFunction2D;
import org.jfree.data.function.PowerFunction2D;
import org.jfree.data.general.DatasetUtilities;
import org.jfree.data.statistics.Regression;
import org.jfree.data.xy.*;
import org.jfree.ui.ApplicationFrame;
import org.jfree.ui.RefineryUtilities;


public class CregresionGrafica extends ApplicationFrame {







static final class DemoPanel extends JPanel
{


private XYDataset data1;






public XYDataset createSampleData1()
{
double[] x={};
double[] y={};

XYSeries xyseries = new XYSeries("Series 1");
xyseries.add(2, 3);
xyseries.add(3, 5);
xyseries.add(4, 5.5);
xyseries.add(5, 6);
xyseries.add(6, 8);
xyseries.add(7, 9.5);


XYSeriesCollection xyseriescollection = new XYSeriesCollection(xyseries);
return xyseriescollection;
}

private JTabbedPane createContent()
{
JTabbedPane jtabbedpane = new JTabbedPane();
jtabbedpane.add("Linear", createChartPanel1());
jtabbedpane.add("Power", createChartPanel2());
return jtabbedpane;
}

private ChartPanel createChartPanel1()
{
NumberAxis numberaxis = new NumberAxis("X");
numberaxis.setAutoRangeIncludesZero(false);
NumberAxis numberaxis1 = new NumberAxis("Y");
numberaxis1.setAutoRangeIncludesZero(false);
XYLineAndShapeRenderer xylineandshaperenderer = new XYLineAndShapeRenderer(false, true);
XYPlot xyplot = new XYPlot(data1, numberaxis, numberaxis1, xylineandshaperenderer);
double ad[] = Regression.getOLSRegression(data1, 0);
LineFunction2D linefunction2d = new LineFunction2D(ad[0], ad[1]);
XYDataset xydataset = DatasetUtilities.sampleFunction2D(linefunction2d, 2D, 11D, 100, "Fitted Regression Line");
xyplot.setDataset(1, xydataset);
XYLineAndShapeRenderer xylineandshaperenderer1 = new XYLineAndShapeRenderer(true, false);
xylineandshaperenderer1.setSeriesPaint(0, Color.blue);
xyplot.setRenderer(1, xylineandshaperenderer1);
JFreeChart jfreechart = new JFreeChart("Linear Regression", JFreeChart.DEFAULT_TITLE_FONT, xyplot, true);
ChartPanel chartpanel = new ChartPanel(jfreechart, false);
return chartpanel;
}

private ChartPanel createChartPanel2()
{
NumberAxis numberaxis = new NumberAxis("X");
numberaxis.setAutoRangeIncludesZero(false);
NumberAxis numberaxis1 = new NumberAxis("Y");
numberaxis1.setAutoRangeIncludesZero(false);
XYLineAndShapeRenderer xylineandshaperenderer = new XYLineAndShapeRenderer(false, true);
XYPlot xyplot = new XYPlot(data1, numberaxis, numberaxis1, xylineandshaperenderer);
double ad[] = Regression.getPowerRegression(data1, 0);
PowerFunction2D powerfunction2d = new PowerFunction2D(ad[0], ad[1]);
XYDataset xydataset = DatasetUtilities.sampleFunction2D(powerfunction2d, 2D, 11D, 100, "Fitted Regression Line");
XYLineAndShapeRenderer xylineandshaperenderer1 = new XYLineAndShapeRenderer(true, false);
xylineandshaperenderer1.setSeriesPaint(0, Color.blue);
xyplot.setDataset(1, xydataset);
xyplot.setRenderer(1, xylineandshaperenderer1);
JFreeChart jfreechart = new JFreeChart("Power Regression", JFreeChart.DEFAULT_TITLE_FONT, xyplot, true);
ChartPanel chartpanel = new ChartPanel(jfreechart, false);
return chartpanel;
}

public DemoPanel()
{
super(new BorderLayout());
data1 = createSampleData1();
add(createContent());
}
}


public CregresionGrafica(String s)
{
super(s);
JPanel jpanel = createDemoPanel();
getContentPane().add(jpanel);
}

public static JPanel createDemoPanel()
{
return new DemoPanel();
}

public void regresacion() {

{
CregresionGrafica regressiondemo1 = new CregresionGrafica("Regression Demo 1");


regressiondemo1.pack();
RefineryUtilities.centerFrameOnScreen(regressiondemo1);
regressiondemo1.setVisible(true);
}
}



desde el menu necesito llamar esta clase pero tambien pasarle los datos que estan en la clase menu a la clase regresion para que grafique los puntos, trate de hacerlo por constructor o por import la verdad no me funiono o no lo supe hacer por favor alguien que me ayude se los agradeceria demasiado.