List of usage examples for java.awt Panel setSize
public void setSize(int width, int height)
From source file:com.seniorproject.augmentedreality.chart.ChartCreator.java
public Panel drawChart() { dataset = createDataset();/*from w w w . j a v a2s .c o m*/ chart = createChart(dataset); chartPanel = new ChartPanel(chart); // chartPanel.setPreferredSize(new java.awt.Dimension(640, 480)); Panel panel = new Panel(); panel.setSize(640, 480); panel.add(chartPanel); panel.setVisible(true); return panel; }
From source file:org.geoserver.wms.WMSTestSupport.java
/** * Shows <code>image</code> in a Frame. * //from www .j a v a 2 s. c om * @param frameName * @param timeOut * @param image */ public static void showImage(String frameName, long timeOut, final BufferedImage image) { int width = image.getWidth(); int height = image.getHeight(); if (((System.getProperty("java.awt.headless") == null) || !System.getProperty("java.awt.headless").equals("true")) && INTERACTIVE) { Frame frame = new Frame(frameName); frame.addWindowListener(new WindowAdapter() { public void windowClosing(WindowEvent e) { e.getWindow().dispose(); } }); Panel p = new Panel(null) { // no layout manager so it respects // setSize public void paint(Graphics g) { g.drawImage(image, 0, 0, this); } }; frame.add(p); p.setSize(width, height); frame.pack(); frame.setVisible(true); try { Thread.sleep(timeOut); } catch (InterruptedException e) { e.printStackTrace(); } frame.dispose(); } }