void (Container parent) { synchronized (parent.getTreeLock()) { Dimension size = parent.getSize(); for (int i = 0; i < parent.getComponentCount(); i++) { if (parent.getComponent(i).getClass() == JPanel.class) parent.getComponent(i).setBounds(0, 0, size.width, size.height); } } }