}
/**
- * Calculate the width of the alignment labels based on the displayed names
- * and any bounds on label width set in preferences.
+ * Calculates the width of the alignment labels based on the displayed names
+ * and any bounds on label width set in preferences. The calculated width is
+ * also set as a property of the viewport.
*
* @return Dimension giving the maximum width of the alignment label panel
* that should be used.
*/
public Dimension calculateIdWidth()
{
+ int oldWidth = av.getIdWidth();
+
// calculate sensible default width when no preference is available
Dimension r = null;
if (av.getIdWidth() < 0)
r.width = av.getIdWidth();
r.height = 0;
}
+
+ /*
+ * fudge: if desired width has changed, update layout
+ * (see also paintComponent - updates layout on a repaint)
+ */
+ if (r.width != oldWidth)
+ {
+ idPanelHolder.setPreferredSize(r);
+ validate();
+ }
return r;
}
}
}
- /**
- * DOCUMENT ME!
- *
- * @param g
- * DOCUMENT ME!
- */
@Override
public void paintComponent(Graphics g)
{