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: 4249732
Votes 1
Synopsis JComboBox (Windows L&F) does not resemble native Windows combo
Category java:classes_swing
Reported Against 1.2.2
Release Fixed 1.4(merlin-beta2)
State 10-Fix Delivered, request for enhancement
Priority: 4-Low
Related Bugs
Submit Date 25-JUN-1999
Description




JComboBox displaying a tree does not look like native
Windows combobox (displaying a tree).

1. JComboBox highlights entire row in the dropdown menu
   while selecting. (Native combo only highlights extent of
   "row content").

2. Native combo displays a "focus border" around the text
   of the selected value in the dropdown menu. JComboBox
   does not.

3. Native combo makes an image in the selected row darker
   while it is highlighted. JComboBox does not.


JComboBox example: SwingSet demo, "ComboBox" tab,
                   lower right combobox (with the "swing" tree).

Native Windows example: Start menu, "Find", "Files or Folders",
the "Look in:" combobox.


I am using JDK 1.2.2rc1 on Windows 98.

Please, I want the "Windows L&F" in Swing to be as close to
the native look and feel as possible.
Preferably *identical*
(Review ID: 84846) 
======================================================================
Work Around




use MFC ?
======================================================================
Evaluation
The user brings up some valid details that are left out in the Windows LAF implementation of the JComboBox. To clarify the points:

1. The native Windows implementation will only highlight the text only rather than the entire line like the Swing implementation.

2. When an item is selected from the drop down list in an editable combo box, the selected item is marked as selected in the combo box editor.

3. I'm not too sure about this point. Both of my implementations appear to be identical. I'm using Desert as my Windows scheme and the colors for native and Swing appear to be consistent.

We will fix this for the next major release of the JDK.
 xxxxx@xxxxx  2000-04-27




Swing does not automatically support displaying trees in JComboBox. This is done by custom client code which, apart from other things, provides a cell renderer used to display tree nodes inside combo box. This is the renderer that defines how exactly these tree nodes look. There's no such thing in Swing as "JComboBox displaying a tree".

In case of SwingSet, a special class, TreeCombo, was used for displaying tree inside the combobox. It defined a renderer, ListEntryRenderer, which was responsible for the problem described in this report. However, SwingSet seems no longer supported.

 xxxxx@xxxxx  2001-07-03

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




Problem described under No.2 should nevertheless be fixed: in an
editable combo, when an item is choosen from the dropdown list,
it should be selected in the editor. This is the way Windows combos
work.

 xxxxx@xxxxx  2001-07-17

======================================================================
Comments
  
  Include a link with my name & email   

Submitted On 24-AUG-1999
durech
Most of these problems could be handled by a
custom ListCellRenderer that returns a JPanel
containing two JLabels. The first contains an
icon, the second contains a text string.  When
a list item is selected, just highlight the JLabel
containing the text.  I say COULD be handled 
because the JCombBox field an instance of a 
CellRendererPane.  Unfortunately, this class is
derived from a JLabel.  When JComboCox attempts
to extract the JPanel object from list, it does
not know what to do with it (since it is not
derived from JLabel), so it displays NOTHING.
If JComboBox is going to use a JList to display
it's list of available selections, it should be 
able to display any type of object that can be
returned from a JList (i.e. any Component).



PLEASE NOTE: JDK6 is formerly known as Project Mustang