void () { Component[] components = getComponents(); Rectangle r = getBounds(); for (Component c : components) { if (c instanceof JScrollPane) { // Main scroll panel: MyScrollPane c.setBounds(0, 0, r.width, r.height); } else { // Floating toolbar: EditorFloatingToolbar Dimension d = c.getPreferredSize(); int rightInsets = getVerticalScrollBar().getWidth() + (isMirrored() ? myGutterComponent.getWidth() : 0); c.setBounds(r.width - d.width - rightInsets - 20, 20, d.width, d.height); } } }