void (Container parent) { Dimension size = parent.getSize(); if (owner != null) { Rectangle visible = owner.getVisibleRect(); size.width = visible.x + visible.width; } Insets i = parent.getInsets(); Dimension pref = rendererComponent.getPreferredSize(); rendererComponent.setBounds(i.left, i.top, Math.max(pref.width, size.width - i.left - i.right), size.height - i.top - i.bottom); }