void () { final Component[] components = getComponents(); final Rectangle bounds = getBounds(); for (Component component : components) { if (component == myGlobalScrollBar) { int scrollBarWidth = myGlobalScrollBar.getPreferredSize().width; component.setBounds(bounds.width - scrollBarWidth, 0, scrollBarWidth, bounds.height); } else { component.setBounds(0, 0, bounds.width, bounds.height); } } }