Java Solaris Communities Sun Store Join SDN My Profile Why Join?
 
Bug Database
Bug Detail
Quick Lists
Top 25 Bugs
Top 25 RFE's
Recently Closed Bugs
Printable Page Printable Page


Bug Database
Bug ID: 6818229
Votes 0
Synopsis Nimbus LookAndFeel does not paint alternate row colors
Category java:classes_swing
Reported Against
Release Fixed 6u14(b04)
State 11-Closed, Unverified, bug
Priority: 2-High
Related Bugs
Submit Date 17-MAR-2009
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.
Posted Date : 2009-03-17 09:27:35.0
Work Around
N/A
Evaluation
Regression from 6802944. For some reason Synth relies on some colors to be _not_ UIResources. As part of 6802944 fix, generator was changed to generate UIResources only. This should be reverted.
Posted Date : 2009-03-18 14:44:20.0
Comments
  
  Include a link with my name & email   

Submitted On 05-APR-2009
SWPalmer
Shouldn't the fix have gone to Synth to remove the odd-ball reliance on non UIResource Colors?



PLEASE NOTE: JDK6 is formerly known as Project Mustang