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

Nimbus LookAndFeel does not paint alternate row colors

    XMLWordPrintable

    Details

    • Subcomponent:
    • Introduced In Build:
      b03
    • Introduced In Version:
    • Resolved In Build:
      b04
    • CPU:
      x86
    • OS:
      linux
    • Verification:
      Not verified

      Description

      FULL PRODUCT VERSION :
      java version "1.6.0_14-ea"
      Java(TM) SE Runtime Environment (build 1.6.0_14-ea-b03)
      Java HotSpot(TM) Server VM (build 14.0-b12, mixed mode)

      ADDITIONAL OS VERSION INFORMATION :
      Linux 2.6.27-13-generic #1 SMP Thu Feb 26 07:26:43 UTC 2009 i686 GNU/Linux

      A DESCRIPTION OF THE PROBLEM :
      Nimbus LookAndFeel usually paints every second row using an alternateRowColor. Selected rows are usually painted using a dark blue color. This feature worked on 1.6.0_10 and 1.6.0_12 but does not work anymore on 1.6.0_14.
      The selection background is not painted (remains white).

      STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
      see sourcecode

      EXPECTED VERSUS ACTUAL BEHAVIOR :
      EXPECTED -
      Every second row is painted using Table.alternateRowColor. The selection background color is used to paint the background of selected cells.
      ACTUAL -
      All rows (selected or not) are painted using a white background.

      ERROR MESSAGES/STACK TRACES THAT OCCUR :
      No error is displayed in the console.

      REPRODUCIBILITY :
      This bug can be reproduced always.

      ---------- BEGIN SOURCE ----------
      import javax.swing.*;
      import javax.swing.table.AbstractTableModel;
      import java.awt.*;


      public class NimbusTableError
      {
          @SuppressWarnings({"ALL"})
          public static void main(String[] args)
          {
              EventQueue.invokeLater(new Runnable()
              {
                  @Override
                  public void run()
                  {
                      initAndShowGUI();
                  }
              });
          }


          private static void initAndShowGUI()
          {
              try
              {
                  UIManager.LookAndFeelInfo[] installedLookAndFeels = UIManager.getInstalledLookAndFeels();
                  UIManager.LookAndFeelInfo nimbusLAFInfo = null;
                  for (UIManager.LookAndFeelInfo installedLookAndFeel : installedLookAndFeels)
                  {
                      if ("Nimbus".equals(installedLookAndFeel.getName()))
                      {
                          nimbusLAFInfo = installedLookAndFeel;
                          break;
                      }
                  }

                  if (nimbusLAFInfo != null)
                  {
                      UIManager.setLookAndFeel(nimbusLAFInfo.getClassName());
                  }
              }
              catch (Exception e)
              {
                  e.printStackTrace();
              }

              JFrame frame = new JFrame();

              JTable table = new JTable(new AbstractTableModel()
              {
                  @Override
                  public int getRowCount()
                  {
                      return 5;
                  }


                  @Override
                  public int getColumnCount()
                  {
                      return 3;
                  }


                  @Override
                  public Object getValueAt(int rowIndex, int columnIndex)
                  {
                      return rowIndex + "-" + columnIndex;
                  }
              });

              frame.getContentPane().add(new JScrollPane(table));

              frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
              frame.setBounds(100, 100, 300, 300);
              frame.setVisible(true);
          }
      }
      ---------- END SOURCE ----------

      Release Regression From : 6u12
      The above release value was the last known release where this
      bug was not reproducible. Since then there has been a regression.

        Attachments

          Activity

            People

            Assignee:
            peterz Peter Zhelezniakov
            Reporter:
            igor Igor Nekrestyanov (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: