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

JInternalFrame title bar does not scale to or ignore titleFont size with XP L&F

XMLWordPrintable

      Name: gm110360 Date: 05/18/2003


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

      FULL OS VERSION :
      Microsoft Windows XP [Version 5.1.2600]

      A DESCRIPTION OF THE PROBLEM :
      With the XP Look and Feel, the title bar font for JInternalFrames comes from
      the InternalFrame.titleFont UIManager value, but the title bar is not scaled
      based on that font. This is a problem for us (requires a work-around) because
      our application has a "scale all fonts" option. The correct behavior should
      probably be to ignore InternalFrame.titleFont and use the system font and
      size always. The Metal L&F JInternalFrame title bar scales to the font, while
      the Motif L&F doesn't use the UIManager setting.


      STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
      Run code on XP.


      EXPECTED VERSUS ACTUAL BEHAVIOR :
      EXPECTED -
      Expect the JInternalFrame title bar to fit the font.

      ACTUAL -
      The font in the title bar is taller than the title bar.


      REPRODUCIBILITY :
      This bug can be reproduced always.

      ---------- BEGIN SOURCE ----------

         import java.awt.Font;
         import javax.swing.*;

          public class TitlePaneBug extends JFrame {
         
             public static void main(String[] args) {
               try {
                  UIManager.setLookAndFeel("com.sun.java.swing.plaf.windows.WindowsLookAndFeel"); }
                   catch(Exception e) {}
            
               UIDefaults defaults = UIManager.getDefaults();
               UIManager.put("InternalFrame.titleFont", new Font("Dialog", Font.PLAIN, 60));
            
               (new TitlePaneBug()).setVisible(true);
            }
         
             public TitlePaneBug() {
               setSize(400, 400);
               JDesktopPane dtp = new JDesktopPane();
            
               JInternalFrame jif = new JInternalFrame("A", true, false, true, true);
               jif.setTitle("Test");
               jif.setSize(200, 200);
               jif.setVisible(true);
               dtp.add(jif);
               getContentPane().add(dtp);
            }
         
         }

      ---------- END SOURCE ----------

      CUSTOMER SUBMITTED WORKAROUND :
      Check Look and Feel and OS to avoid changing InternalFrame.titleFont
      UIManager value with XP L&F.
      (Review ID: 185913)
      ======================================================================

            Unassigned Unassigned
            gmanwanisunw Girish Manwani (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: