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

Nimbus Size variant does not work in java version "1.6.0_12"

    Details

      Description

      FULL PRODUCT VERSION :
      java version "1.6.0_12"
      Java(TM) SE Runtime Environment (build 1.6.0_12-b04)
      Java HotSpot(TM) Client VM (build 11.2-b01, mixed mode, sharing)

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

      A DESCRIPTION OF THE PROBLEM :
      Nimbus Size variant does not work in java version "1.6.0_12". This worked in java version "1.6.0_10".

      STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
      Simply compile and run the attached source.

      EXPECTED VERSUS ACTUAL BEHAVIOR :
      EXPECTED -
      After running the above code I expect to see a JFrame with two text fields and two buttons. The first text field should be 'mini' and the second should be 'large'. The first button should be 'mini' and the second should be 'large'.
      ACTUAL -
      After running the above code I was a JFrame with two text fields and two buttons. They were all of 'regular' size.

      REPRODUCIBILITY :
      This bug can be reproduced always.

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


      import java.awt.BorderLayout;
      import java.awt.FlowLayout;

      import javax.swing.JButton;
      import javax.swing.JFormattedTextField;
      import javax.swing.JFrame;
      import javax.swing.JPanel;
      import javax.swing.SwingUtilities;
      import javax.swing.UIManager;
      import javax.swing.WindowConstants;

      public class NimbusSizeVariant {

          public static void main(String[] args) {
              SwingUtilities.invokeLater(new Runnable() {
                  public void run() {
                  
                  
                      for (UIManager.LookAndFeelInfo laf : UIManager.getInstalledLookAndFeels()) {
                          if ("Nimbus".equals(laf.getName())){
                              try {
                                  UIManager.setLookAndFeel(laf.getClassName());
                                  
                              } catch (Exception e) {
                                  e.printStackTrace();
                              }
                          }
                      }

                      JFrame frame = new JFrame("Nimbus UI Test");
                     
                      SwingUtilities.updateComponentTreeUI(frame);
                      
                      
                      frame.setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE);
                      frame.getContentPane().setLayout(new BorderLayout());
                      JPanel panel = new JPanel(new FlowLayout());

                      //mini text field
                      JFormattedTextField miniTF = new JFormattedTextField("mini");
                      miniTF.putClientProperty("JComponent.sizeVariant", "mini");
                      panel.add(miniTF);
                      
                      //large text field
                      JFormattedTextField largeTF = new JFormattedTextField("large");
                      largeTF.putClientProperty("JComponent.sizeVariant", "large");
                      panel.add(largeTF);

                      //mini button
                      JButton miniBtn = new JButton("mini");
                      miniBtn.putClientProperty("JComponent.sizeVariant", "mini");
                      panel.add(miniBtn);
                      
                      //large button
                      JButton largeBtn = new JButton("large");
                      largeBtn.putClientProperty("JComponent.sizeVariant", "large");
                      panel.add(largeBtn);
                      

                      frame.getContentPane().add(panel, BorderLayout.CENTER);
                      frame.pack();
                      frame.setLocationRelativeTo(null);
                      frame.setVisible(true);
                  }
              });
          }
      }
      ---------- END SOURCE ----------

        Attachments

          Activity

            People

            • Assignee:
              serb Sergey Bylokhov
              Reporter:
              ndcosta Nelson Dcosta (Inactive)
            • Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

              • Created:
                Updated:
                Imported:
                Indexed: