JDK-5024626 : XP L&F: Disabled editable JComboBox doesn't draw correctly in WinXP laf
  • Type: Bug
  • Component: client-libs
  • Sub-Component: javax.swing
  • Affected Version: 1.4.2
  • Priority: P4
  • Status: Closed
  • Resolution: Cannot Reproduce
  • OS: windows_xp
  • CPU: x86
  • Submitted: 2004-03-31
  • Updated: 2011-01-20
  • Resolved: 2011-01-20
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
JDK 7
7Resolved
Related Reports
Relates :  
Relates :  
Description
Name: rmT116609			Date: 03/31/2004


FULL PRODUCT VERSION :
java version "1.4.2_03"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.2_03-b01)
Java HotSpot(TM) Client VM (build 1.4.2_03-b01, mixed mode)

java version "1.5.0-beta"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0-beta-b32c)
Java HotSpot(TM) Client VM (build 1.5.0-beta-b32c, mixed mode)


ADDITIONAL OS VERSION INFORMATION :
Microsoft Windows XP [Version 5.1.2600]

A DESCRIPTION OF THE PROBLEM :
When you disable a JComboBox that is editable and set its preferred sized to be larger, You can see a white strip drawn (incorrectly) to the left of the drop down arrow. If you compare with other look-and-feels, you can see that in Win XP LAF the arrow is narrower, and the white strip is where the arrow occupies in other LAFs.

STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
Run the sample code provided in Windows XP, using the Windows XP windowing style.


EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
No white strip to the left of the drop down arrow.
ACTUAL -
There is a white strip to the left of the drop down arrow.

REPRODUCIBILITY :
This bug can be reproduced always.

---------- BEGIN SOURCE ----------
import java.awt.BorderLayout;
import java.awt.Dimension;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;

import javax.swing.JButton;
import javax.swing.JComboBox;
import javax.swing.JFrame;
import javax.swing.JPanel;
import javax.swing.UIManager;

public class TestApp implements ActionListener
{
	JFrame frame = null;
	private JComboBox cb;

	public TestApp()
	{
		try
		{
			UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
		}
		catch (Exception e)
		{
			e.printStackTrace();
		}
				
		JFrame frame = new JFrame();
		frame.setTitle(System.getProperty("java.version"));
		frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
		
		JPanel actionPanel = createActionPanel();
		frame.getContentPane().add(actionPanel, BorderLayout.CENTER);

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


	public static void main(String[] args)
	{
		new TestApp();
	}
	
	public JPanel createActionPanel()
	{
		JPanel actionPanel = new JPanel();
		
		JButton actionButton = new JButton("Toggle Combo Box");
		actionButton.setActionCommand("ACTION");

		this.cb = new JComboBox();
		cb.setPreferredSize(new Dimension(100, 50));
		
		cb.addItem("Test");
	
		cb.setEditable(true);
		cb.setEnabled(false);
			
		actionButton.addActionListener(this);
		
		
		actionPanel.add(actionButton);
		actionPanel.add(cb);

		return actionPanel;
	}

	public void actionPerformed(ActionEvent e)
	{
		if (e.getActionCommand().equals("ACTION"))
		{
			this.cb.setEnabled(!this.cb.isEnabled());
		}
	}

}
---------- END SOURCE ----------
(Incident Review ID: 245814) 
======================================================================

Comments
EVALUATION The disabled JComboBox looks perfect in jdk7. Answer for Leif: in the test the JComboBox is large because of specified preffered size.
20-01-2011

CONVERTED DATA BugTraq+ Release Management Values COMMIT TO FIX: mustang
25-09-2004

EVALUATION Not reproducible starting with 1.5-beta build 32. Probably fixed by fix for bug 4919687. ###@###.### 2004-04-08 Clarification: The white strip is not visible after fix for bug 4919687, but the large square area is still taken up by the arrow button. This should be fixed in a later release. Reopened. ###@###.### 2004-04-08
08-04-2004