- fontName.setSelectedItem(lastSelected.getName());
- fontStyle.setSelectedIndex(lastSelStyle);
- fontSize.setSelectedItem("" + lastSelSize);
- monospaced.setSelected(lastSelMono);
- JOptionPane
- .showInternalMessageDialog(
- this,
- "Font doesn't have letters defined\nso cannot be used\nwith alignment data.",
- "Invalid Font", JOptionPane.WARNING_MESSAGE);
+ String message = iBounds.getHeight() < 1 ? MessageManager
+ .getString("label.font_doesnt_have_letters_defined")
+ : MessageManager.getString("label.font_too_small");
+ JOptionPane.showInternalMessageDialog(this, message,
+ MessageManager.getString("label.invalid_font"),
+ JOptionPane.WARNING_MESSAGE);
+ /*
+ * Restore the changed value - note this will reinvoke this method via the
+ * ActionListener, but now validation should pass
+ */
+ if (lastSelected.getSize() != (Integer) fontSize.getSelectedItem()) // autoboxing
+ {
+ fontSize.setSelectedItem(lastSelected.getSize());
+ }
+ if (!lastSelected.getName().equals(
+ fontName.getSelectedItem().toString()))
+ {
+ fontName.setSelectedItem(lastSelected.getName());
+ }
+ if (lastSelected.getStyle() != fontStyle.getSelectedIndex())
+ {
+ fontStyle.setSelectedIndex(lastSelected.getStyle());
+ }
+ if (lastSelMono != monospaced.isSelected())
+ {
+ monospaced.setSelected(lastSelMono);
+ }