JDK-5029504 : Empty JComboBox drop-down list is unexpectedly high
  • Type: Bug
  • Component: client-libs
  • Sub-Component: javax.swing
  • Affected Version: 5.0
  • Priority: P4
  • Status: Resolved
  • Resolution: Fixed
  • OS: generic
  • CPU: generic
  • Submitted: 2004-04-09
  • Updated: 2004-10-13
  • Resolved: 2004-09-14
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 6
6 betaFixed
Related Reports
Relates :  
Description

Name: iaR10016			Date: 04/09/2004


Filed By : J2SE-SQA [###@###.###
JDK      : JDK1.5.0-b46, JDK1.4.2-b28
Platforms: all

Empty JComboBox drop-down list is unexpectedly high.

The following test example creates a JFrame with empty JCombobox:

--------- test.java ---------
import javax.swing.*;

public class test {
    public static void main(String[] args) {
      JFrame frame = new JFrame("JComboBox Test");
      frame.getContentPane().add(new JComboBox());
      frame.setSize(new java.awt.Dimension(400, 50));
      frame.setVisible(true);
     }
}
-----------------------------

Please, run the test and click JCombobox button to reproduce the failure.

This bug affects JCK1.5-runtime (b15) interactive test
api/javax_swing/interactive/JComboBoxTests.html#JComboBox[JComboBoxTest0010].

Specific machine info:
======================
Hostname: linux-5
OS: RedHat Linux 9.0 (GNOME)

======================================================================

Comments
CONVERTED DATA BugTraq+ Release Management Values COMMIT TO FIX: mustang FIXED IN: mustang INTEGRATED IN: mustang
14-09-2004

SUGGESTED FIX Name: azR10139 Date: 04/19/2004 *** /net/fatum/ws/tiger/webrev/src/share/classes/javax/swing/plaf/basic/BasicComboPopup.java- Mon Apr 19 19:34:26 2004 --- BasicComboPopup.java Mon Apr 19 19:32:57 2004 *** 1144,1155 **** for ( int i = 0; i < minRowCount; ++i ) { value = list.getModel().getElementAt( i ); Component c = renderer.getListCellRendererComponent( list, value, i, false, false ); height += c.getPreferredSize().height; } ! ! return height == 0 ? 100 : height; } /** * Calculate the placement and size of the popup portion of the combo box based * on the combo box location and the enclosing screen bounds. If --- 1144,1154 ---- for ( int i = 0; i < minRowCount; ++i ) { value = list.getModel().getElementAt( i ); Component c = renderer.getListCellRendererComponent( list, value, i, false, false ); height += c.getPreferredSize().height; } ! return height == 0 ? comboBox.getHeight() : height; } /** * Calculate the placement and size of the popup portion of the combo box based * on the combo box location and the enclosing screen bounds. If ======================================================================
14-09-2004

EVALUATION Name: azR10139 Date: 04/19/2004 When we are calculating the size of the combo popup we are returning 100 pixels if combobox has no items. The idea of suggested fix is to return combobox's height instead. ###@###.### 2004-04-19 ======================================================================
19-04-2004