void () { super.doLayout(); int count = getComponentCount(); for (int i = 0; i < count; i++) { Component component = getComponent(i); Rectangle bounds = component.getBounds(); if (bounds.x < 0 || bounds.y < 0) { component.setBounds(bounds.x < 0 ? 20 : bounds.x, bounds.y < 0 ? 20 : bounds.y, bounds.width, bounds.height); } } }