public void doLayout() { super.doLayout(); if (getScrollbarDisplayPolicy() == SCROLLBARS_NEVER) { // Use this class's calculateChildSize() and re-do layout of child Component c = getComponent(0); Dimension cs = calculateChildSize(); Insets i = getInsets(); c.setBounds(i.left, i.top, cs.width, cs.height); } }