Here you can find the source of showGUI(final JComponent newContentPane, final String windowTitle, final Dimension size)
private static JFrame showGUI(final JComponent newContentPane, final String windowTitle, final Dimension size)
//package com.java2s; //License from project: Open Source License import java.awt.Dimension; import javax.swing.JComponent; import javax.swing.JFrame; public class Main { private static JFrame showGUI(final JComponent newContentPane, final String windowTitle, final Dimension size) { // Create and set up the window. final JFrame frame = new JFrame(windowTitle); // Create and set up the content pane. newContentPane.setOpaque(true); // content panes must be opaque frame.setContentPane(newContentPane); // Display the window. if (size == null) { frame.pack();//from w w w .ja va 2 s . com } else { frame.setSize(size); } frame.setLocationRelativeTo(null); frame.setVisible(true); return frame; } }