Iterator beans = graph.nodes.iterator();
while (beans.hasNext()) {
Bean bean = (Bean) beans.next();
// Calculate bean's dimension with a temporary bean figure
BeanFigure dummy = new BeanFigure(bean);
dummy.setFont(font);
Dimension size = dummy.getPreferredSize();
bean.width = size.width;
bean.height = size.height;
bean.preferredHeight = size.height;
}