This patch (committed) updates two font methods to observe the setting of the
'swing.boldMetal' UI default value:
2006-09-12 David Gilbert <[EMAIL PROTECTED]>
* javax/swing/plaf/metal/DefaultMetalTheme.java
(CONTROL_TEXT_FONT): Renamed 'controlTextFont',
(MENU_TEXT_FONT): Renamed 'menuTextFont',
(getControlTextFont): Check 'swing.boldMetal' setting before
initialising font,
(getMenuTextFont): Likewise.
Mauve tests covering this have already been committed.
Regards,
Dave
Index: javax/swing/plaf/metal/DefaultMetalTheme.java
===================================================================
RCS file:
/sources/classpath/classpath/javax/swing/plaf/metal/DefaultMetalTheme.java,v
retrieving revision 1.4
diff -u -r1.4 DefaultMetalTheme.java
--- javax/swing/plaf/metal/DefaultMetalTheme.java 13 Jul 2005 11:56:02
-0000 1.4
+++ javax/swing/plaf/metal/DefaultMetalTheme.java 12 Sep 2006 14:24:12
-0000
@@ -40,6 +40,7 @@
import java.awt.Font;
+import javax.swing.UIManager;
import javax.swing.plaf.ColorUIResource;
import javax.swing.plaf.FontUIResource;
@@ -63,10 +64,6 @@
private static final ColorUIResource SECONDARY3 =
new ColorUIResource(204, 204, 204);
- private static final FontUIResource CONTROL_TEXT_FONT =
- new FontUIResource("Dialog", Font.BOLD, 12);
- private static final FontUIResource MENU_TEXT_FONT =
- new FontUIResource("Dialog", Font.BOLD, 12);
private static final FontUIResource SUB_TEXT_FONT =
new FontUIResource("Dialog", Font.PLAIN, 10);
private static final FontUIResource SYSTEM_TEXT_FONT =
@@ -76,6 +73,12 @@
private static final FontUIResource WINDOW_TITLE_FONT =
new FontUIResource("Dialog", Font.BOLD, 12);
+ /** The control text font. */
+ private FontUIResource controlTextFont;
+
+ /** The menu text font. */
+ private FontUIResource menuTextFont;
+
/**
* Creates a new instance of this theme.
*/
@@ -156,23 +159,42 @@
/**
* Returns the font used for text on controls. In this case, the font is
- * <code>FontUIResource("Dialog", Font.BOLD, 12)</code>.
+ * <code>FontUIResource("Dialog", Font.BOLD, 12)</code>, unless the
+ * <code>swing.boldMetal</code> UI default is set to [EMAIL PROTECTED]
Boolean#FALSE}
+ * in which case it is <code>FontUIResource("Dialog", Font.PLAIN, 12)</code>.
*
* @return The font.
*/
public FontUIResource getControlTextFont()
{
- return CONTROL_TEXT_FONT;
+ if (controlTextFont == null)
+ {
+ if (Boolean.FALSE.equals(UIManager.get("swing.boldMetal")))
+ controlTextFont = new FontUIResource("Dialog", Font.PLAIN, 12);
+ else
+ controlTextFont = new FontUIResource("Dialog", Font.BOLD, 12);
+ }
+ return controlTextFont;
}
+
/**
* Returns the font used for text in menus. In this case, the font is
- * <code>FontUIResource("Dialog", Font.BOLD, 12)</code>.
+ * <code>FontUIResource("Dialog", Font.BOLD, 12)</code>, unless the
+ * <code>swing.boldMetal</code> UI default is set to [EMAIL PROTECTED]
Boolean#FALSE}
+ * in which case it is <code>FontUIResource("Dialog", Font.PLAIN, 12)</code>.
*
* @return The font used for text in menus.
*/
public FontUIResource getMenuTextFont()
{
- return MENU_TEXT_FONT;
+ if (menuTextFont == null)
+ {
+ if (Boolean.FALSE.equals(UIManager.get("swing.boldMetal")))
+ menuTextFont = new FontUIResource("Dialog", Font.PLAIN, 12);
+ else
+ menuTextFont = new FontUIResource("Dialog", Font.BOLD, 12);
+ }
+ return menuTextFont;
}
/**