Dimension (Container container) { Dimension size = new Dimension(); if (container instanceof Breadcrumbs breadcrumbs) { breadcrumbs.updatePreferredSize(size, breadcrumbs.getScale()); } JBInsets.addTo(size, container.getInsets()); return size; }