Java examples for Swing:JFrame
create Swing JFrame
//package com.java2s; import javax.swing.*; public class Main { public static JFrame createFrame(String title, JPanel panel) { JFrame frame = new JFrame(title); frame.setContentPane(panel);/* w ww .ja v a2 s . c o m*/ frame.setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE); frame.pack(); frame.setVisible(true); return frame; } }