Java JFrame setPanel(JPanel parent, JPanel child, JFrame f)

Here you can find the source of setPanel(JPanel parent, JPanel child, JFrame f)

Description

Sets a panel inside a panel and updates the size of the containing window.

License

Open Source License

Parameter

Parameter Description
parent The parent panel.
child The panel to set inside the parent one.
f The frame containing everything.

Declaration

public static void setPanel(JPanel parent, JPanel child, JFrame f) 

Method Source Code

//package com.java2s;
//License from project: Open Source License 

import javax.swing.JFrame;

import javax.swing.JPanel;

public class Main {
    /**//  w w w  .ja  va 2s  .  c  o m
     * Sets a panel inside a panel and updates the size of the containing
     * window.
     * 
     * @param parent The parent panel.
     * @param child The panel to set inside the parent one.
     * @param f The frame containing everything.
     */
    public static void setPanel(JPanel parent, JPanel child, JFrame f) {

        parent.removeAll();
        parent.add(child);
        parent.updateUI();
        f.pack();

    }
}

Related

  1. setFrameTitle(JFrame frame, File file)
  2. setGeneralParameters(final JFrame window)
  3. setInfo(String info, JFrame root)
  4. setJFrameAlwaysOnTop(JFrame frame, boolean newValue)
  5. setMainWindowLocation(JFrame jfrm, String strPropertiesFilePath, String strPropertiesFileName)
  6. setPersistentExtendedStateMask(JFrame frame, int persistentExtendedStateMask)
  7. setWindowListenerDispose(JFrame frame)
  8. setWindowRightSide(final JFrame frame)
  9. setWinVisible(final JFrame win, final boolean vis)