Java JFrame addPanelToFrame(final JFrame frame, final JPanel panel, final String title)

Here you can find the source of addPanelToFrame(final JFrame frame, final JPanel panel, final String title)

Description

Adds the panel to frame.

License

Apache License

Parameter

Parameter Description
frame the frame
panel the panel
title the title

Exception

Parameter Description
HeadlessException the headless exception

Declaration

public static void addPanelToFrame(final JFrame frame, final JPanel panel, final String title)
        throws HeadlessException 

Method Source Code

//package com.java2s;
/*//from   ww  w  .  j a v  a 2 s  .  co m
 * Copyright 2002-2016 Jalal Kiswani.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

import java.awt.ComponentOrientation;

import java.awt.HeadlessException;

import javax.swing.JFrame;

import javax.swing.JPanel;

public class Main {
    static ComponentOrientation defaultComponentOrientation = ComponentOrientation.LEFT_TO_RIGHT;

    /**
     * Adds the panel to frame.
     *
     * @param frame
     *            the frame
     * @param panel
     *            the panel
     * @param title
     *            the title
     * @throws HeadlessException
     *             the headless exception
     */
    public static void addPanelToFrame(final JFrame frame, final JPanel panel, final String title)
            throws HeadlessException {
        frame.add(panel);
        frame.setTitle(title);
        frame.applyComponentOrientation(getDefaultComponentOrientation());
    }

    /**
     * Gets the default component orientation.
     *
     * @return the default component orientation
     */

    public static ComponentOrientation getDefaultComponentOrientation() {
        return defaultComponentOrientation;
    }
}

Related

  1. activateWindowClosingButton(JFrame frame)
  2. addDisposeActionWithEscapeKey(final JFrame frame)
  3. addEscapeExitListeners(final JFrame window)
  4. addEscapeListener(final JFrame frame)
  5. addJFrameReporter(JFrame to)
  6. addProgressBar(final JFrame win)
  7. addToQue(JFrame frame)
  8. allPlatformGetFile(String dialogTitle, File locationIn, final String fileExtension, FileFilter nonMacFileFilter, boolean allowMultipleSelect, JFrame parentFrame)
  9. askSave(JFrame frame)