Java JPanel Child removeComponentFromPanel(Component removeComponent, JPanel fromPanel)

Here you can find the source of removeComponentFromPanel(Component removeComponent, JPanel fromPanel)

Description

removePanelFromPanel removes a specific Component from another panel

License

Apache License

Parameter

Parameter Description
removeComponent the component to be removed
fromPanel from what panel

Declaration

static public void removeComponentFromPanel(Component removeComponent, JPanel fromPanel) 

Method Source Code


//package com.java2s;
//License from project: Apache License 

import javax.swing.*;
import java.awt.*;

public class Main {
    /**/*from  w w w  . j  av a 2s .  c om*/
     * removePanelFromPanel removes a specific Component from another panel
     *
     * @param removeComponent the component to be removed
     * @param fromPanel from what panel
     */
    static public void removeComponentFromPanel(Component removeComponent, JPanel fromPanel) {
        fromPanel.remove(removeComponent);
        fromPanel.revalidate();
        fromPanel.repaint();
    }
}

Related

  1. fillPanel(final JPanel panel, final GridBagConstraints gbc)
  2. fillPanel(JPanel panel, Component... components)
  3. getOutermostContainer(JPanel container)
  4. packPanel(JPanel p, int width)
  5. padPanel(Object innerPanel, JPanel outerPanel, int pad)
  6. removePanel(JPanel parent, JPanel panel)
  7. resetControlsInAPanel(JPanel panel)
  8. resizeJPanel(JPanel p)
  9. unmaskContainer(JPanel pnl)