create Swing JFrame - Java Swing

Java examples for Swing:JFrame

Description

create Swing JFrame

Demo Code


//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;
    }
}

Related Tutorials