Example usage for org.jfree.ui ApplicationFrame ApplicationFrame

List of usage examples for org.jfree.ui ApplicationFrame ApplicationFrame

Introduction

In this page you can find the example usage for org.jfree.ui ApplicationFrame ApplicationFrame.

Prototype

public ApplicationFrame(final String title) 

Source Link

Document

Constructs a new application frame.

Usage

From source file:org.mili.jmibs.jfree.examples.Example5.java

/**
 * @param args//from www.j av  a  2s .com
 */
public static void main(String[] args) {
    /* list with iterations. */
    List<Integer> il = new ArrayList<Integer>() {
        {
            add(100);
            add(1000);
            add(10000);
        }
    };

    /* list with object loadings. */
    List<Integer> ol = new ArrayList<Integer>() {
        {
            add(1000);
            add(10000);
        }
    };

    /* create the suite. */
    BenchmarkSuite bs = DefaultIterationObjectLoadBenchmarkSuite.create(il, ol);

    /* add some benches. */
    bs.addBenchmark(new ReplaceStringBenchmark());
    bs.addBenchmark(new ReplaceStringAppendBenchmark());
    bs.addBenchmark(new ReplaceStringAppendSingleBenchmark());

    /* execute the suite. */
    IterationObjectLoadBenchmarkSuiteResult bsr = (IterationObjectLoadBenchmarkSuiteResult) bs.execute();

    /* create a renderer. */
    BenchmarkSuiteResultRenderer<JFreeChart> bsrr = JFreeChartBarIterationObjectLoadBenchmarkSuiteResultRenderer
            .create();

    /* display the results. */
    ApplicationFrame af = new ApplicationFrame(bsr.getBenchmarkSuite().getName());
    ChartPanel chartPanel = new ChartPanel(bsrr.render(bsr));
    chartPanel.setFillZoomRectangle(true);
    chartPanel.setMouseZoomable(true);
    chartPanel.setPreferredSize(new Dimension(640, 480));
    af.setContentPane(chartPanel);
    af.pack();
    RefineryUtilities.centerFrameOnScreen(af);
    af.setVisible(true);
}

From source file:org.mili.jmibs.jfree.examples.Example4.java

/**
 * @param args/*from w  ww .ja v a 2  s  . c om*/
 */
public static void main(String[] args) {
    /* list with iterations. */
    List<Integer> il = new ArrayList<Integer>() {
        {
            add(100);
            add(1000);
            add(10000);
        }
    };

    /* list with object loadings. */
    List<Integer> ol = new ArrayList<Integer>() {
        {
            add(1000);
            add(10000);
        }
    };

    /* create the suite. */
    BenchmarkSuite bs = DefaultIterationObjectLoadBenchmarkSuite.create(il, ol);

    /* add some benches. */
    bs.addBenchmark(new AppendStringBufferBenchmark());
    bs.addBenchmark(new AppendStringBuilderBenchmark());
    bs.addBenchmark(new AppendStringConcatBenchmark());
    bs.addBenchmark(new AppendStringPlusBenchmark());

    /* execute the suite. */
    IterationObjectLoadBenchmarkSuiteResult bsr = (IterationObjectLoadBenchmarkSuiteResult) bs.execute();

    /* create a renderer. */
    BenchmarkSuiteResultRenderer<JFreeChart> bsrr = JFreeChartBarIterationObjectLoadBenchmarkSuiteResultRenderer
            .create();

    /* display the results. */
    ApplicationFrame af = new ApplicationFrame(bsr.getBenchmarkSuite().getName());
    ChartPanel chartPanel = new ChartPanel(bsrr.render(bsr));
    chartPanel.setFillZoomRectangle(true);
    chartPanel.setMouseZoomable(true);
    chartPanel.setPreferredSize(new Dimension(640, 480));
    af.setContentPane(chartPanel);
    af.pack();
    RefineryUtilities.centerFrameOnScreen(af);
    af.setVisible(true);
}

From source file:org.mili.jmibs.jfree.examples.Example6.java

/**
 * @param args//from www  .  ja  v  a2  s. c om
 */
public static void main(String[] args) {
    /* list with iterations. */
    List<Integer> il = new ArrayList<Integer>() {
        {
            add(100);
            add(1000);
            add(10000);
        }
    };

    /* list with object loadings. */
    List<Integer> ol = new ArrayList<Integer>() {
        {
            add(10);
            add(20);
            add(30);
            add(40);
            add(50);
        }
    };

    /* create the suite. */
    BenchmarkSuite bs = DefaultIterationObjectLoadBenchmarkSuite.create(il, ol);

    /* add some benches. */
    // really slow ...
    //bs.addBenchmarkClass(FibonacciRecursiveBenchmark.class);
    bs.addBenchmark(new FibonacciEndRecursiveBenchmark());
    bs.addBenchmark(new FibonacciNonRecursiveBenchmark());
    bs.addBenchmark(new FibonacciExplicitBenchmark());

    /* execute the suite. */
    IterationObjectLoadBenchmarkSuiteResult bsr = (IterationObjectLoadBenchmarkSuiteResult) bs.execute();

    /* create a renderer. */
    BenchmarkSuiteResultRenderer<JFreeChart> bsrr = JFreeChartBarIterationObjectLoadBenchmarkSuiteResultRenderer
            .create();

    /* display the results. */
    ApplicationFrame af = new ApplicationFrame(bsr.getBenchmarkSuite().getName());
    ChartPanel chartPanel = new ChartPanel(bsrr.render(bsr));
    chartPanel.setFillZoomRectangle(true);
    chartPanel.setMouseZoomable(true);
    chartPanel.setPreferredSize(new Dimension(640, 480));
    af.setContentPane(chartPanel);
    af.pack();
    RefineryUtilities.centerFrameOnScreen(af);
    af.setVisible(true);
}

From source file:org.mili.jmibs.jfree.examples.Example3.java

/**
 * @param args// ww  w  .  ja  v  a 2s .  c o m
 */
public static void main(String[] args) {
    /* list with iterations. */
    List<Integer> il = new ArrayList<Integer>() {
        {
            add(100);
            add(1000);
            add(10000);
        }
    };

    /* list with object loadings. */
    List<Integer> ol = new ArrayList<Integer>() {
        {
            add(1000);
            add(10000);
        }
    };

    /* create the suite. */
    BenchmarkSuite bs = DefaultIterationObjectLoadBenchmarkSuite.create(il, ol);

    /* add some benches. */
    bs.addBenchmark(new TraverseForEachArrayListStringBenchmark());
    bs.addBenchmark(new TraverseHighSpeedIdiomArrayListStringBenchmark());
    bs.addBenchmark(new TraverseForEachVectorStringBenchmark());
    bs.addBenchmark(new TraverseHighSpeedIdiomVectorStringVariableOutsideBenchmark());
    bs.addBenchmark(new TraverseHighSpeedIdiomVectorStringBenchmark());

    /* execute the suite. */
    IterationObjectLoadBenchmarkSuiteResult bsr = (IterationObjectLoadBenchmarkSuiteResult) bs.execute();

    /* create a renderer. */
    BenchmarkSuiteResultRenderer<JFreeChart> bsrr = JFreeChartBarIterationObjectLoadBenchmarkSuiteResultRenderer
            .create();

    /* display the results. */
    ApplicationFrame af = new ApplicationFrame(bsr.getBenchmarkSuite().getName());
    ChartPanel chartPanel = new ChartPanel(bsrr.render(bsr));
    chartPanel.setFillZoomRectangle(true);
    chartPanel.setMouseZoomable(true);
    chartPanel.setPreferredSize(new Dimension(640, 480));
    af.setContentPane(chartPanel);
    af.pack();
    RefineryUtilities.centerFrameOnScreen(af);
    af.setVisible(true);
}

From source file:org.mili.jmibs.jfree.examples.Example2.java

/**
 * @param args//from   ww w  .  j  av  a2 s .com
 */
public static void main(String[] args) {
    /* list with iterations. */
    List<Integer> il = new ArrayList<Integer>() {
        {
            add(100);
            add(1000);
            add(10000);
        }
    };

    /* list with object loadings. */
    List<Integer> ol = new ArrayList<Integer>() {
        {
            add(100);
            add(1000);
            add(10000);
        }
    };

    /* create the suite. */
    BenchmarkSuite bs = DefaultIterationObjectLoadBenchmarkSuite.create(il, ol);

    /* add some benches. */
    bs.addBenchmark(new TraverseForEachArrayListStringBenchmark());
    bs.addBenchmark(new TraverseHighSpeedIdiomArrayListStringBenchmark());

    /* execute the suite. */
    IterationObjectLoadBenchmarkSuiteResult bsr = (IterationObjectLoadBenchmarkSuiteResult) bs.execute();

    /* create a renderer. */
    /*
     * @doc jMibs/II/Getting Started Guide/1. Object load/4. How report my results with jFree?{
     * To create a JFreeChart for an object load suite result, use class
     * &quot;JFreeChartBarIterationObjectLoadBenchmarkSuiteResultRenderer&quot;. It produces
     * a simple chart from your results. The application is as the string renderer. It
     * renders to an JFreeChart object. Simply switch the renderer like following:}
     * @doc jMibs/II/Getting Started Guide/1. Object load/4. How report my results with jFree?(Pre){
     * BenchmarkSuiteResultRenderer<JFreeChart> bsrr = JFreeChartBarIterationObjectLoadBenchmarkSuiteResultRenderer.create(); }
     */
    BenchmarkSuiteResultRenderer<JFreeChart> bsrr = JFreeChartBarIterationObjectLoadBenchmarkSuiteResultRenderer
            .create();

    /* display the results. */
    /*
     * @doc jMibs/II/Getting Started Guide/1. Object load/4. How report my results with jFree?{
     * This chart you can pack into a chart panel and application frame, like this:}
     * @doc jMibs/II/Getting Started Guide/1. Object load/4. How report my results with jFree?(Pre){
     * ApplicationFrame af = new ApplicationFrame(bsr.getBenchmarkSuite().getName());
     * ChartPanel chartPanel = new ChartPanel(bsrr.render(bsr));
     * chartPanel.setFillZoomRectangle(true);
     * chartPanel.setMouseZoomable(true);
     * chartPanel.setPreferredSize(new Dimension(640, 480));
     * af.setContentPane(chartPanel);
     * af.pack(); RefineryUtilities.centerFrameOnScreen(af);
     * af.setVisible(true); }
     */
    ApplicationFrame af = new ApplicationFrame(bsr.getBenchmarkSuite().getName());
    ChartPanel chartPanel = new ChartPanel(bsrr.render(bsr));
    chartPanel.setFillZoomRectangle(true);
    chartPanel.setMouseZoomable(true);
    chartPanel.setPreferredSize(new Dimension(640, 480));
    af.setContentPane(chartPanel);
    af.pack();
    RefineryUtilities.centerFrameOnScreen(af);
    af.setVisible(true);
}

From source file:edu.psu.citeseerx.misc.charts.CiteChartBuilderJFree.java

public static void main(String[] args) throws Exception {

    DataSource csxDataSource = DBCPFactory.createDataSource("citeseerx");
    DataSource cgDataSource = DBCPFactory.createDataSource("citegraph");

    CSXDAO csxdao = new CSXDAO();
    csxdao.setDataSource(csxDataSource);

    CiteClusterDAO citedao = new CiteClusterDAOImpl();
    citedao.setDataSource(cgDataSource);

    CiteChartBuilderJFree builder = new CiteChartBuilderJFree();
    builder.setCiteClusterDAO(citedao);/*w  w w . j  a va2  s .c  o m*/

    Document doc = csxdao.getDocumentFromDB("10.1.1.1.3288", false, false);
    JFreeChart chart = builder.buildChart(doc);

    ApplicationFrame frame = new ApplicationFrame("Chart Test");
    ChartPanel chartPanel = new ChartPanel(chart);
    chartPanel.setPreferredSize(new Dimension(500, 500));
    frame.setContentPane(chartPanel);
    frame.pack();
    RefineryUtilities.centerFrameOnScreen(frame);
    frame.setVisible(true);

}

From source file:org.openimaj.demos.sandbox.PlotFlickrGeo.java

public static void main(String[] args) throws IOException {
    File inputcsv = new File("/Users/jsh2/Desktop/world-geo.csv");
    List<float[]> data = new ArrayList<float[]>(10000000);

    //read in images
    BufferedReader br = new BufferedReader(new FileReader(inputcsv));
    String line;//  w  ww  .  j  a v a2 s .c o  m
    int i = 0;
    while ((line = br.readLine()) != null) {
        String[] parts = line.split(",");

        float longitude = Float.parseFloat(parts[0]);
        float latitude = Float.parseFloat(parts[1]);

        data.add(new float[] { longitude, latitude });

        if (i++ % 10000 == 0)
            System.out.println(i);
    }

    System.out.println("Done reading");

    float[][] dataArr = new float[2][data.size()];
    for (i = 0; i < data.size(); i++) {
        dataArr[0][i] = data.get(i)[0];
        dataArr[1][i] = data.get(i)[1];
    }

    NumberAxis domainAxis = new NumberAxis("X");
    domainAxis.setRange(-180, 180);
    NumberAxis rangeAxis = new NumberAxis("Y");
    rangeAxis.setRange(-90, 90);
    FastScatterPlot plot = new FastScatterPlot(dataArr, domainAxis, rangeAxis);

    JFreeChart chart = new JFreeChart("Fast Scatter Plot", plot);
    chart.getRenderingHints().put(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);

    ChartPanel chartPanel = new ChartPanel(chart);
    chartPanel.setPreferredSize(new java.awt.Dimension(500, 270));
    final ApplicationFrame frame = new ApplicationFrame("Title");
    frame.setContentPane(chartPanel);
    frame.pack();
    frame.setVisible(true);
}

From source file:exemploJFreeChart.TelaGrafico.java

public TelaGrafico() {
    janela = new ApplicationFrame("Exemplo JFreeChart");
    janela.setDefaultCloseOperation(ApplicationFrame.EXIT_ON_CLOSE);

    JFreeChart graficoLinha = ChartFactory.createLineChart("Titulo do Grafico", "Nome do eixo X",
            "Nome do eixo Y", criarDataset(), // mtodo que cria os dados do grfico
            PlotOrientation.VERTICAL, true, true, false); // legenda, tooltips, urls

    ChartPanel painelGrafico = new ChartPanel(graficoLinha);
    painelGrafico.setPreferredSize(new Dimension(600, 400));

    janela.setContentPane(painelGrafico);
    janela.pack();//from   ww  w.  j  a v  a2s  . com
    RefineryUtilities.centerFrameOnScreen(janela);
}

From source file:SeriesDiarias.VisualizadorSeries.java

/**
 * Constri a visualizao dos dados. Cria a janela e o grfico a ser exibido
 * nela./* w  w  w  .ja  v a 2  s  .c  om*/
 * 
 * @param serieDados A srie de dados que ter seus dados exibidos em um grfico
 */
public VisualizadorSeries(SerieDadosDiarios serieDados) {
    // cria a janela
    janela = new ApplicationFrame("Visualizador Series Diarias");
    janela.setDefaultCloseOperation(ApplicationFrame.EXIT_ON_CLOSE);

    // cria o grfico que contm os dados da srie
    JFreeChart graficoLinha = ChartFactory.createLineChart(serieDados.obterIdentificacaoSerie(), // Ttulo do grfico
            "Dia", // Nome do eixo X
            "Valor", // Nome do eixo Y
            criarDataset(serieDados), // mtodo que cria os dados do grfico
            PlotOrientation.VERTICAL, // Orientao do grfico
            true, true, false); // legenda, tooltips, urls

    // adiciona o grfico na janela
    ChartPanel painelGrafico = new ChartPanel(graficoLinha);
    painelGrafico.setPreferredSize(new Dimension(600, 400));
    janela.setContentPane(painelGrafico);
    janela.pack();

    // posiciona a janela aleatoriamente na tela
    RefineryUtilities.positionFrameRandomly(janela);
}

From source file:javatest.IndicatorsToChart.java

/**
 * Displays a chart in a frame./*from w ww .  j  a va2  s .com*/
 * @param chart the chart to be displayed
 */
private static void displayChart(JFreeChart chart) {
    // Chart panel
    ChartPanel panel = new ChartPanel(chart);
    panel.setFillZoomRectangle(true);
    panel.setMouseWheelEnabled(true);
    panel.setPreferredSize(new java.awt.Dimension(1000, 540));
    // Application frame
    ApplicationFrame frame = new ApplicationFrame("neli - Indicators to chart");
    frame.setContentPane(panel);
    frame.pack();
    RefineryUtilities.centerFrameOnScreen(frame);
    frame.setVisible(true);
}