JDK-4140633 : Wrong JComboBox item height
  • Type: Bug
  • Component: client-libs
  • Sub-Component: javax.swing
  • Affected Version: 1.2.0
  • Priority: P4
  • Status: Closed
  • Resolution: Duplicate
  • OS: windows_nt
  • CPU: x86
  • Submitted: 1998-05-20
  • Updated: 1998-05-20
  • Resolved: 1998-05-20
Related Reports
Duplicate :  
Description

Name: rk38400			Date: 05/20/98


Setting the first JComboBox item to null results
in a bad computation of the height for the following
items. I was really expecting the null string "" to
behave like a space string " ". Here's a sample
to duplicate the problem.

----------------- cut here ----------------
//
// Test case for JComboBox. Setting a null string "" results in an
// inaccurate combo item height computation.
//
//

import com.sun.java.swing.*;
import java.awt.*;
import java.awt.event.*;


public class Test extends JFrame
{
	
	public Test()
	{
		setTitle("JComboBox test");
		setLocation(400, 100);
		setSize(300, 200);
		addWindowListener(new WindowAdapter() {
			public void windowClosing(WindowEvent e) {System.exit(0);}
			});
		
		Container c = getContentPane();
		c.setLayout(new GridLayout(5,1));
		c.setBackground(Color.lightGray);

		JComboBox combo = new JComboBox();
		combo.addItem("");				// This is causing the problem
		combo.addItem("Second");
		combo.addItem("Third");
		c.add(combo);
	}
		
	public static void main(String args[])
	{
		Test test = new Test();

		try {
			UIManager.setLookAndFeel("com.sun.java.swing.plaf.windows.WindowsLookAndFeel");
		}
		catch (Exception e) {
			e.printStackTrace();
		}
		test.show();
	}
}
(Review ID: 30833)
======================================================================

Comments
EVALUATION This is a duplicate of bug 4139900. tom.santos@eng 1998-05-20
20-05-1998