private void updateLabelSizes() { Dictionary labelTable = getLabelTable(); if (labelTable != null) { Enumeration labels = labelTable.elements(); while (labels.hasMoreElements()) { JComponent component = (JComponent) labels.nextElement(); component.setSize(component.getPreferredSize()); } } }
/** * Updates the UIs for the labels in the label table by calling {@code updateUI} on each label. * The UIs are updated from the current look and feel. The labels are also set to their preferred * size. * * @see #setLabelTable * @see JComponent#updateUI */ protected void updateLabelUIs() { Dictionary labelTable = getLabelTable(); if (labelTable == null) { return; } Enumeration labels = labelTable.keys(); while (labels.hasMoreElements()) { JComponent component = (JComponent) labelTable.get(labels.nextElement()); component.updateUI(); component.setSize(component.getPreferredSize()); } }