List of usage examples for org.jfree.ui ApplicationFrame setPreferredSize
public void setPreferredSize(Dimension preferredSize)
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); }/* w ww . j ava 2 s . c o m*/ 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); } }