Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-5063999

JFormattedTextField default font is incorrect under Windows

XMLWordPrintable

    • x86
    • linux_2.6, windows_xp

      Name: js151677 Date: 06/16/2004


      FULL PRODUCT VERSION :
      java version "1.4.2_04"
      Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.2_04-b05)
      Java HotSpot(TM) Client VM (build 1.4.2_04-b05, mixed mode)

      ADDITIONAL OS VERSION INFORMATION :
      Microsoft Windows XP [version 5.1.2600]

      A DESCRIPTION OF THE PROBLEM :
      The default font of JFormattedTextField with the Windows L&F is incorrect.
      It can be seen either with a JSpinner.

      STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
      Create a JFormattedTextField with the Windows Look and Feel.

      EXPECTED VERSUS ACTUAL BEHAVIOR :
      EXPECTED -
      The default font of JFormattedTextField must be the same as the default font for JTextField :
      JFormattedTextField font = javax.swing.plaf.FontUIResource[family=sansserif,name=MS Sans Serif,style=plain,size=11]
      JTextField font = javax.swing.plaf.FontUIResource[family=sansserif,name=MS Sans Serif,style=plain,size=11]
      ACTUAL -
      The font for JFormattedTextField is incorrect.
      It is not the same as JTextField for example :
      JFormattedTextField font = javax.swing.plaf.FontUIResource[family=SansSerif,name=SansSerif,style=plain,size=12]
      JTextField font = javax.swing.plaf.FontUIResource[family=sansserif,name=MS Sans Serif,style=plain,size=11]

      REPRODUCIBILITY :
      This bug can be reproduced always.

      ---------- BEGIN SOURCE ----------
      import javax.swing.*;
      public class TestFont {
      public static void main(String[] args) {
      try {
      UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
      }
      catch (Exception ex) {
      System.out.println(ex);
      }
      System.out.println("JFormattedTextField font = "+new JFormattedTextField().getFont());
      System.out.println("JTextField font = "+new JTextField().getFont());
      }
      }
      ---------- END SOURCE ----------

      CUSTOMER SUBMITTED WORKAROUND :
      Set the font manually.
      It is harder when you use a JSpinner, because you can't access directly to the JFormattedTextField used in the editor.
      (Incident Review ID: 280181)
      ======================================================================

            jmarinacsunw Joshua Marinacci (Inactive)
            jssunw Jitender S (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: