Example usage for org.jfree.ui ApplicationFrame setVisible

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

Introduction

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

Prototype

public void setVisible(boolean b) 

Source Link

Document

Shows or hides this Window depending on the value of parameter b .

Usage

From source file:org.jgrasstools.gears.ui.OmsMatrixCharter.java

@Execute
public void chart() throws Exception {
    if (inData == null && inDataXY == null) {
        throw new ModelsIllegalargumentException("At least one of the datasets need to be valid.", this, pm);
    }//from w  w w.  j a  v a  2  s. c  om

    if (doDump) {
        checkNull(inChartPath);
    }

    JFreeChart chart = null;
    if (pType == 0) {
        chart = doLineChart();
    } else {
        chart = doBarChart();
    }
    if (inSubTitle != null) {
        TextTitle subTitle = new TextTitle(inSubTitle);
        chart.addSubtitle(subTitle);
    }
    chart.setTextAntiAlias(true);

    if (doDump) {
        File chartFile = new File(inChartPath);
        if (!chartFile.getName().endsWith(".png")) {
            chartFile = FileUtilities.substituteExtention(chartFile, "png");
        }
        BufferedImage bufferedImage = chart.createBufferedImage(pWidth, pHeight);
        ImageIO.write(bufferedImage, "png", chartFile);
    }

    if (doChart) {
        ChartPanel cp = new ChartPanel(chart);
        cp.setDomainZoomable(true);
        cp.setRangeZoomable(true);

        ApplicationFrame af = new ApplicationFrame("");
        af.setContentPane(cp);
        af.setPreferredSize(new Dimension(pWidth, pHeight));
        af.pack();
        af.setVisible(true);
        RefineryUtilities.centerFrameOnScreen(af);
    }
}

From source file:qmul.align.AlignmentTester.java

/**
 * Plot a turn vs score chart/*from  w w  w.jav a 2  s . c  o  m*/
 * 
 * @param scores
 * @param title
 */
private void plotScores(List<Double> scores, String title) {
    ApplicationFrame af = new ApplicationFrame(title);
    final XYSeries series = new XYSeries("Coherence scores");
    for (int x = 0; x < scores.size(); x++) {
        series.add(x, scores.get(x));
    }
    final XYSeriesCollection data = new XYSeriesCollection(series);
    final JFreeChart chart = ChartFactory.createXYLineChart(title, "Turn", "Score", data,
            PlotOrientation.VERTICAL, true, true, false);

    final ChartPanel chartPanel = new ChartPanel(chart);
    chartPanel.setPreferredSize(new java.awt.Dimension(1000, 500));
    af.setContentPane(chartPanel);
    af.pack();
    RefineryUtilities.centerFrameOnScreen(af);
    af.setVisible(true);
}

From source file:qmul.align.AlignmentTester.java

/**
 * Plot a turn vs score chart with arbitrary subplots
 * //  w w  w . j  av  a2  s.  c om
 * @param scores1
 * @param title
 */
private void plotScores(String title, List<Double>... scores) {
    ApplicationFrame af = new ApplicationFrame(title);
    final CombinedDomainXYPlot plot = new CombinedDomainXYPlot(new NumberAxis());
    plot.setGap(10.0);

    for (int i = 0; i < scores.length; i++) {

        final XYSeries series = new XYSeries("Coherence scores " + i);
        for (int x = 0; x < scores[i].size(); x++) {
            series.add(x, scores[i].get(x));
        }
        XYSeriesCollection data = new XYSeriesCollection(series);
        XYPlot subplot = new XYPlot(data, null, new NumberAxis(), new StandardXYItemRenderer());
        subplot.setRangeAxisLocation(i == 0 ? AxisLocation.TOP_OR_LEFT : AxisLocation.BOTTOM_OR_LEFT);
        plot.add(subplot, 1);
    }

    plot.setOrientation(PlotOrientation.VERTICAL);
    final JFreeChart chart = new JFreeChart(title, JFreeChart.DEFAULT_TITLE_FONT, plot, false);
    final ChartPanel chartPanel = new ChartPanel(chart);
    chartPanel.setPreferredSize(new java.awt.Dimension(1000, 500));
    af.setContentPane(chartPanel);
    af.pack();
    RefineryUtilities.centerFrameOnScreen(af);
    af.setVisible(true);
}