Here you can find the source of setPanel(JPanel parent, JPanel child, JFrame f)
Parameter | Description |
---|---|
parent | The parent panel. |
child | The panel to set inside the parent one. |
f | The frame containing everything. |
public static void setPanel(JPanel parent, JPanel child, JFrame f)
//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(); } }