Java JFrame Create createSimpleFrame(String title, Component content)

Here you can find the source of createSimpleFrame(String title, Component content)

Description

Creates a simple JFrame that exits on close with a component in its content pane.

License

Open Source License

Parameter

Parameter Description
title the title of the frame.
content the content component to add.

Return

a new JFrame.

Declaration

public static JFrame createSimpleFrame(String title, Component content) 

Method Source Code

//package com.java2s;
/*******************************************************************************
 * Copyright (c) 2009-2014 Black Rook Software
 * All rights reserved. This program and the accompanying materials
 * are made available under the terms of the GNU Lesser Public License v2.1
 * which accompanies this distribution, and is available at
 * http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html
 ******************************************************************************/

import java.awt.Component;

import javax.swing.JFrame;

public class Main {
    /**//from  w  w w  .  ja v  a2  s.co  m
     * Creates a simple JFrame that exits on close with a component
     * in its content pane.
     * @param title the title of the frame.
     * @param content the content component to add.
     * @return a new JFrame.
     * @since 2.4.0
     */
    public static JFrame createSimpleFrame(String title, Component content) {
        JFrame out = new JFrame(title);
        out.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
        out.add(content);
        out.pack();
        return out;
    }
}

Related

  1. createFrame(String title, JPanel panel)
  2. createIFrame(String name)
  3. createImageFrame(Image image)
  4. createNewFrame(String frameName, int width, int height, boolean visible)
  5. createSearchFrame()
  6. createTestFrame()