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

Nimbus-LaF: background color cleared when setting component name of JToolBar

    Details

    • Subcomponent:
    • Resolved In Build:
      b14
    • CPU:
      x86_64
    • OS:
      windows_7

      Description

      FULL PRODUCT VERSION :
      java version "1.8.0_60"
      Java(TM) SE Runtime Environment (build 1.8.0_60-b27)
      Java HotSpot(TM) Client VM (build 25.60-b23, mixed mode)

      ADDITIONAL OS VERSION INFORMATION :
      Microsoft Windows [Version 6.1.7601]

      A DESCRIPTION OF THE PROBLEM :
      with nimbus-laf backgroundcolor gets cleared when setting component name of jtoolbar



      REPRODUCIBILITY :
      This bug can be reproduced always.

      ---------- BEGIN SOURCE ----------
      import java.awt.Component;
      import java.awt.EventQueue;

      import javax.swing.JButton;
      import javax.swing.JCheckBox;
      import javax.swing.JComboBox;
      import javax.swing.JMenu;
      import javax.swing.JPanel;
      import javax.swing.JRadioButton;
      import javax.swing.JScrollPane;
      import javax.swing.JSlider;
      import javax.swing.JTabbedPane;
      import javax.swing.JTable;
      import javax.swing.JTextArea;
      import javax.swing.JTextField;
      import javax.swing.JToolBar;
      import javax.swing.UIManager;
      import javax.swing.plaf.nimbus.NimbusLookAndFeel;

      public class NimbusNull {
        static void tstname(final Component c) {
          System.out.printf("%-30s: bkg set %6b -> setting name -> ",
            c.getClass().getSimpleName(), Boolean.valueOf(c.getBackground() != null));
          c.setName("noname");
          System.out.printf(" bkg set %6b%n",
            Boolean.valueOf(c.getBackground() != null));
        }

        public static void main(final String[] args) {
          EventQueue.invokeLater(new Runnable() {
            @Override
            public void run() {
              try {
                UIManager.setLookAndFeel(NimbusLookAndFeel.class.getName());
              } catch (final Exception e) {
                e.printStackTrace();
              }
              tstname(new JTextArea());
              tstname(new JTextField());
              tstname(new JComboBox());
              tstname(new JCheckBox());
              tstname(new JRadioButton());
              tstname(new JButton());
              tstname(new JPanel());
              tstname(new JTable());
              tstname(new JTabbedPane());
              tstname(new JScrollPane());
              tstname(new JSlider());
              tstname(new JMenu());
              tstname(new JToolBar());
            }
          });
        }
      }

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

        Attachments

          Activity

            People

            • Assignee:
              kabhishek Kumar Abhishek
              Reporter:
              webbuggrp Webbug Group
            • Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: