-
Bug
-
Resolution: Unresolved
-
P4
-
None
-
5.0
-
x86
-
windows_xp
FULL PRODUCT VERSION :
1.5.0_07
ADDITIONAL OS VERSION INFORMATION :
Microsoft Windows XP [Version 5.1.2600]
A DESCRIPTION OF THE PROBLEM :
When you set the background of a JComboBox, there is a different behaviour using a Color object or a ColorUIResource object.
When you use Color, the arrow button also gets the requested color. This should not happen in my opionion. When you instead use a ColorUIResource object, the arrow button remains the default blue-ish gradient.
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
1) Start up the given test program
2) Look at the difference between the arrow buttons of the JComboBoxes
EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
Both JComboBoxes should look the same.
ACTUAL -
The upper JComboBox has a wrong arrow button.
REPRODUCIBILITY :
This bug can be reproduced always.
---------- BEGIN SOURCE ----------
package testing;
import javax.swing.*;
import javax.swing.plaf.ColorUIResource;
import java.awt.*;
/**
*
*/
public class JComboBoxGradientProblem
{
public static void main( String[] args )
{
JFrame frame = new JFrame();
frame.setDefaultCloseOperation( JFrame.EXIT_ON_CLOSE );
JPanel panel = new JPanel();
panel.setLayout( new BoxLayout( panel, BoxLayout.Y_AXIS ) );
JComboBox comboBox1 = new JComboBox( new String[]{"some", "more", "items"} );
comboBox1.setBorder( BorderFactory.createEmptyBorder( 5, 5, 5, 5 ) );
comboBox1.setBackground( Color.YELLOW );
JComboBox comboBox2 = new JComboBox( new String[]{"some", "more", "items"} );
comboBox2.setBorder( BorderFactory.createEmptyBorder( 5, 5, 5, 5 ) );
comboBox2.setBackground( new ColorUIResource( Color.YELLOW ) );
panel.add( comboBox1 );
panel.add( comboBox2 );
panel.setBorder( BorderFactory.createEmptyBorder( 12, 12, 12, 12 ) );
frame.setContentPane( panel );
frame.pack();
frame.setLocationRelativeTo( null );
frame.setVisible( true );
}
}
---------- END SOURCE ----------
CUSTOMER SUBMITTED WORKAROUND :
Using ColorUIResource bypasses the problem.
1.5.0_07
ADDITIONAL OS VERSION INFORMATION :
Microsoft Windows XP [Version 5.1.2600]
A DESCRIPTION OF THE PROBLEM :
When you set the background of a JComboBox, there is a different behaviour using a Color object or a ColorUIResource object.
When you use Color, the arrow button also gets the requested color. This should not happen in my opionion. When you instead use a ColorUIResource object, the arrow button remains the default blue-ish gradient.
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
1) Start up the given test program
2) Look at the difference between the arrow buttons of the JComboBoxes
EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
Both JComboBoxes should look the same.
ACTUAL -
The upper JComboBox has a wrong arrow button.
REPRODUCIBILITY :
This bug can be reproduced always.
---------- BEGIN SOURCE ----------
package testing;
import javax.swing.*;
import javax.swing.plaf.ColorUIResource;
import java.awt.*;
/**
*
*/
public class JComboBoxGradientProblem
{
public static void main( String[] args )
{
JFrame frame = new JFrame();
frame.setDefaultCloseOperation( JFrame.EXIT_ON_CLOSE );
JPanel panel = new JPanel();
panel.setLayout( new BoxLayout( panel, BoxLayout.Y_AXIS ) );
JComboBox comboBox1 = new JComboBox( new String[]{"some", "more", "items"} );
comboBox1.setBorder( BorderFactory.createEmptyBorder( 5, 5, 5, 5 ) );
comboBox1.setBackground( Color.YELLOW );
JComboBox comboBox2 = new JComboBox( new String[]{"some", "more", "items"} );
comboBox2.setBorder( BorderFactory.createEmptyBorder( 5, 5, 5, 5 ) );
comboBox2.setBackground( new ColorUIResource( Color.YELLOW ) );
panel.add( comboBox1 );
panel.add( comboBox2 );
panel.setBorder( BorderFactory.createEmptyBorder( 12, 12, 12, 12 ) );
frame.setContentPane( panel );
frame.pack();
frame.setLocationRelativeTo( null );
frame.setVisible( true );
}
}
---------- END SOURCE ----------
CUSTOMER SUBMITTED WORKAROUND :
Using ColorUIResource bypasses the problem.