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

Changes in the font made using UIManager.put(..) fails in GTKLookAndFeel

    XMLWordPrintable

Details

    • Bug
    • Resolution: Unresolved
    • P4
    • None
    • 6
    • client-libs

    Description

      FULL PRODUCT VERSION :
      jdk 1.6

      ADDITIONAL OS VERSION INFORMATION :
      In Redhat Linux

      EXTRA RELEVANT SYSTEM CONFIGURATION :
      If a new font is set using UIManager.put(.key, new Font(.....) ,

      A DESCRIPTION OF THE PROBLEM :
      GTKLookAndFeel ignores this new font and shows the screens in the desktop font set in the OS. If some other look and feels is selected (Motif) changes in the font can be noticed in the screen displayed subsequently.

      STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
       Execute the following code snippet.
      -------------
      UIManager.put("Label.font", null);
      UIManager.put("Label.font", UIManager.get("List.font"));
      UIManager.put("Label.font", new Font("Serif", Font.BOLD, 25));
      //System.out.println(UIManager.getCrossPlatformLookAndFeelClassName());
      //UIManager.setLookAndFeel(UIManager.getCrossPlatformLookAndFeelClassName());


      System.out.println(UIManager.getSystemLookAndFeelClassName());
      UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());

      JPanel panel =new JPanel( );
      panel.add(new JLabel("Test Me"));
      JFrame window=new JFrame("Test Fonts");
      window.getContentPane().add(panel);
      window.setSize(new Dimension(100,100));
      window.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
      // ..
      // ..
      window.setVisible(true);

      EXPECTED VERSUS ACTUAL BEHAVIOR :
      EXPECTED -
      The text displayed in Big and Bold Font.
      ACTUAL -
      The text displayed in normal Font.

      REPRODUCIBILITY :
      This bug can be reproduced always.

      ---------- BEGIN SOURCE ----------
      UIManager.put("Label.font", null);
      UIManager.put("Label.font", UIManager.get("List.font"));
      UIManager.put("Label.font", new Font("Serif", Font.BOLD, 25));
      //System.out.println(UIManager.getCrossPlatformLookAndFeelClassName());
      //UIManager.setLookAndFeel(UIManager.getCrossPlatformLookAndFeelClassName());


      System.out.println(UIManager.getSystemLookAndFeelClassName());
      UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());

      JPanel panel =new JPanel( );
      panel.add(new JLabel("Test Me"));
      JFrame window=new JFrame("Test Fonts");
      window.getContentPane().add(panel);
      window.setSize(new Dimension(100,100));
      window.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
      // ..
      // ..
      window.setVisible(true);
      ---------- END SOURCE ----------

      Attachments

        Activity

          People

            peterz Peter Zhelezniakov
            ndcosta Nelson Dcosta (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Imported:
              Indexed: