X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;f=src%2Fjalview%2Fgui%2FFontChooser.java;h=156f5631d1a6736200b9b4c942f25fb4b46a10e1;hb=db93a1adcbe0a4eaaf06e0a70ade0d6c5c1961c3;hp=92d2b2b22efbf76e9d19ef427d703d1664c3c80c;hpb=0c193e97c4cbf94e27ed356c20108fce733f4123;p=jalview.git diff --git a/src/jalview/gui/FontChooser.java b/src/jalview/gui/FontChooser.java index 92d2b2b..156f563 100755 --- a/src/jalview/gui/FontChooser.java +++ b/src/jalview/gui/FontChooser.java @@ -1,6 +1,6 @@ /* - * Jalview - A Sequence Alignment Editor and Viewer ($$Version-Rel$$) - * Copyright (C) $$Year-Rel$$ The Jalview Authors + * Jalview - A Sequence Alignment Editor and Viewer (Version 2.9.0b2) + * Copyright (C) 2015 The Jalview Authors * * This file is part of Jalview. * @@ -20,18 +20,19 @@ */ package jalview.gui; +import jalview.bin.Cache; +import jalview.jbgui.GFontChooser; +import jalview.util.MessageManager; + import java.awt.Font; import java.awt.FontMetrics; import java.awt.event.ActionEvent; +import java.awt.geom.Rectangle2D; import javax.swing.JInternalFrame; import javax.swing.JLayeredPane; import javax.swing.JOptionPane; -import jalview.bin.Cache; -import jalview.jbgui.GFontChooser; -import jalview.util.MessageManager; - /** * DOCUMENT ME! * @@ -156,6 +157,7 @@ public class FontChooser extends GFontChooser init = false; } + @Override public void smoothFont_actionPerformed(ActionEvent e) { ap.av.antiAlias = smoothFont.isSelected(); @@ -169,6 +171,7 @@ public class FontChooser extends GFontChooser * @param e * DOCUMENT ME! */ + @Override protected void ok_actionPerformed(ActionEvent e) { try @@ -193,6 +196,7 @@ public class FontChooser extends GFontChooser * @param e * DOCUMENT ME! */ + @Override protected void cancel_actionPerformed(ActionEvent e) { if (ap != null) @@ -241,15 +245,17 @@ public class FontChooser extends GFontChooser fontStyle.getSelectedIndex(), (Integer) fontSize.getSelectedItem()); FontMetrics fm = getGraphics().getFontMetrics(newFont); - double mw = fm.getStringBounds("M", getGraphics()).getWidth(), iw = fm - .getStringBounds("I", getGraphics()).getWidth(); + double mw = fm.getStringBounds("M", getGraphics()).getWidth(); + final Rectangle2D iBounds = fm.getStringBounds("I", getGraphics()); + double iw = iBounds.getWidth(); if (mw < 1 || iw < 1) { - JOptionPane - .showInternalMessageDialog( - this, - MessageManager.getString("label.font_doesnt_have_letters_defined"), - MessageManager.getString("label.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 @@ -298,6 +304,7 @@ public class FontChooser extends GFontChooser * @param e * DOCUMENT ME! */ + @Override protected void fontName_actionPerformed(ActionEvent e) { if (init) @@ -314,6 +321,7 @@ public class FontChooser extends GFontChooser * @param e * DOCUMENT ME! */ + @Override protected void fontSize_actionPerformed(ActionEvent e) { if (init) @@ -330,6 +338,7 @@ public class FontChooser extends GFontChooser * @param e * DOCUMENT ME! */ + @Override protected void fontStyle_actionPerformed(ActionEvent e) { if (init) @@ -346,6 +355,7 @@ public class FontChooser extends GFontChooser * * @param e */ + @Override public void defaultButton_actionPerformed(ActionEvent e) { Cache.setProperty("FONT_NAME", fontName.getSelectedItem().toString());