void () { final Component c = getComponent(); if (c == null) return; final Dimension compSize = c.getPreferredSize(); final Dimension size = getSize(); final Couple<Integer> x = (type == TYPE.BOTH || type == TYPE.HORIZONTAL) ? getFit(compSize.width, size.width) : Couple.of(0, compSize.width); final Couple<Integer> y = (type == TYPE.BOTH || type == TYPE.VERTICAL) ? getFit(compSize.height, size.height) : Couple.of(0, compSize.height); c.setBounds(x.first.intValue(), y.first.intValue(), x.second.intValue(), y.second.intValue()); }