DropDown List Bug Demonstration

Platforms Affected

Too many Choice() items result in missing values in the drop down list for Netscape on UNIX.

Related: Mac behavior is to draw a huge choice() box with tiny arrows at the top and bottom for scrolling.

Details On The DropDown List Bug

The Java AWT Choice() component is used to display a list of items that expands when the user clicks on it. This differs from a listbox which always takes up extra real estate on the screen.

If the dropdown list gets very large in the Choice() component, the JDK should automatically add a scrollbar to the dropdown list so the user can scroll through all the choices.

Unfortunately, some browser platforms do not do this. Instead, they display some arbitrary maximum amount of elements for selection based on screen/panel real estate available. The rest of the elements do not get displayed and the user is given no clue that there is more to choose from.

The code demo at the bottom of this page demonstrates this bug by filling a Choice() dropdown component with 100 labels. UNIX Netscape will not display all of these in the available real estate on the screen, nor will it provide the ability to scroll to get to this data.

Dropdown Bug Workaround

I know of no workaround to this problem. Use a third party combobox library component which draws the dropdown on its own, or consider a different mechanism if your Choice() list is very large.

Without buying a library or writing your own combobox component, you could code an alternative into your application. For example, you could code a button whose label contains the current selection in it. When the button's label is clicked, you could display a dialog which contains a scrolling list box of the choices you would have normally displayed in a drop down and return this selection to the original button.

This alternative implementation is demonstrated below.

References

N/A. Please submit other references to me.

Applet Demonstrating DropDown List Bug

View The Source To DropDownBug.java

Applet With DropDown Bug Workaround (Alternate Coding Style)

View The Source To DropDownFix.java
View The Source To DropDownFixFrame.java
View The Source To DropDownFixSelector.java

Gunther Birznieks <gunther@clark.net>