// Try to preserve selected weight across fonts:
ListEntry selected = weightList.getSelectedEntry();
String current = selected != null ? selected.getText() : null;
selected = null;
weightList.removeAll();
FontFamily family = getFontFamily();
if (family != null) {
for (FontWeight weight : family) {
ListEntry entry = new ListEntry(weightList);
String name = weight.getName();
entry.setText(name);