"30", "36", "48", "72" };
public MUIFactory() {
size = new DefaultComboBoxModel(MUIFactory.FONT_SIZES);
styles = new DefaultComboBoxModel();
final ModeController modeController = Controller.getCurrentModeController();
final MNodeStyleController styleController = (MNodeStyleController) modeController
.getExtension(NodeStyleController.class);
final GraphicsEnvironment gEnv = GraphicsEnvironment.getLocalGraphicsEnvironment();
final String[] envFonts = gEnv.getAvailableFontFamilyNames();
fonts = new DefaultComboBoxModel(envFonts);
final ListDataListener fontsListener = new ListDataListener() {
public void intervalRemoved(final ListDataEvent e) {
}
public void intervalAdded(final ListDataEvent e) {
}
public void contentsChanged(final ListDataEvent e) {
if (e.getIndex0() != -1) {
return;
}
if (ignoreChangeEvent) {
return;
}
ignoreChangeEvent = true;
final DefaultComboBoxModel source = (DefaultComboBoxModel) e.getSource();
styleController.setFontFamily((String) source.getSelectedItem());
ignoreChangeEvent = false;
}
};
fonts.addListDataListener(fontsListener);
final ListDataListener sizeListener = new ListDataListener() {
public void intervalRemoved(final ListDataEvent e) {
}
public void intervalAdded(final ListDataEvent e) {
}
public void contentsChanged(final ListDataEvent e) {
if (e.getIndex0() != -1) {
return;
}
if (ignoreChangeEvent) {
return;
}
try {
final DefaultComboBoxModel source = (DefaultComboBoxModel) e.getSource();
final int intSize = Integer.parseInt(((String) source.getSelectedItem()));
styleController.setFontSize(intSize);
}
catch (final NumberFormatException nfe) {
}
}
};