Here you can find the source of createAndShowDemoFrame(final String demoTitle, final Container demoContainer)
public static void createAndShowDemoFrame(final String demoTitle, final Container demoContainer)
//package com.java2s; //License from project: Open Source License import java.awt.Container; import javax.swing.JFrame; import javax.swing.SwingUtilities; public class Main { public static void createAndShowDemoFrame(final String demoTitle, final Container demoContainer) { SwingUtilities.invokeLater(() -> { JFrame frame = new JFrame(demoTitle); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.setContentPane(demoContainer); frame.pack();//from w w w . j a v a2s .c om frame.setVisible(true); }); } }