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

Changing to Nimbus LAF and back doesn't reset look and feel of JTable completely

    Details

    • Type: Bug
    • Status: Open
    • Priority: P4
    • Resolution: Unresolved
    • Affects Version/s: 6u10
    • Fix Version/s: None
    • Component/s: client-libs
    • Subcomponent:
    • CPU:
      x86
    • OS:
      windows_xp, windows_vista

      Description

      FULL PRODUCT VERSION :


      A DESCRIPTION OF THE PROBLEM :
      Try this example code:



      STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
      import java.awt.BorderLayout;

      import javax.swing.JFrame;
      import javax.swing.JScrollPane;
      import javax.swing.JTable;
      import javax.swing.SwingUtilities;
      import javax.swing.UIManager;
      import javax.swing.UnsupportedLookAndFeelException;

      /**
       *
       */

      /**
       * @author Stefan Rybacki
       *
       */
      public class NimbusTable {

        /**
         * @param args
         * @throws UnsupportedLookAndFeelException
         * @throws IllegalAccessException
         * @throws InstantiationException
         * @throws ClassNotFoundException
         */
        public static void main(String[] args) throws ClassNotFoundException,
                                              InstantiationException,
                                              IllegalAccessException,
                                              UnsupportedLookAndFeelException {
          SwingUtilities.invokeLater(new Runnable() {

            @Override
            public void run() {
              JFrame frame = new JFrame();
              frame.setLayout(new BorderLayout());
              frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
              frame.add(new JScrollPane(
                  new JTable(new Object[][] { { "V1", "V2", "V3" },
                      { "V1", "V2", "V3" }, { "V1", "V2", "V3" } },
                      new Object[] { "C1", "C2", "C3" })),
                  BorderLayout.CENTER);

              try {
                UIManager
                    .setLookAndFeel("com.sun.java.swing.plaf.nimbus.NimbusLookAndFeel");
              } catch (Exception e) {
                e.printStackTrace();
              }

              
              
              SwingUtilities.updateComponentTreeUI(frame);

              try {
                UIManager
                    .setLookAndFeel("javax.swing.plaf.metal.MetalLookAndFeel");
              } catch (Exception e) {
                e.printStackTrace();
              }

              SwingUtilities.updateComponentTreeUI(frame);
              
              frame.add(new JScrollPane(
                  new JTable(new Object[][] { { "V1", "V2", "V3" },
                      { "V1", "V2", "V3" }, { "V1", "V2", "V3" } },
                      new Object[] { "C1", "C2", "C3" })),
                  BorderLayout.SOUTH);

              frame.setVisible(true);
              frame.pack();
              
            }
          });
        }

      }

      EXPECTED VERSUS ACTUAL BEHAVIOR :
      EXPECTED -
      Both table should look the same since we are back to Metal look and feel
      ACTUAL -
      the upper table still has Nimbus look and feel for the actual data area of the table.

      REPRODUCIBILITY :
      This bug can be reproduced always.

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                Unassigned
                Reporter:
                igor Igor Nekrestyanov (Inactive)
              • Votes:
                0 Vote for this issue
                Watchers:
                0 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Imported:
                  Indexed: