int (@NotNull Container parent) { int parentWidth = parent.getWidth(); if (myProgressComponent != null) { return parentWidth - myProgressComponent.getPreferredSize().width - myOffset.get(); } int visibleCount = 0; for (Component component : myButtonComponents) { if (component.isVisible()) { parentWidth -= component.getPreferredSize().width; visibleCount++; } } parentWidth -= myButtonOffset.get() * (visibleCount - 1); if (visibleCount > 0) { parentWidth -= myOffset.get(); } return parentWidth; }