United StatesChange Country, Oracle Worldwide Web Sites Communities I am a... I want to...
JDK-4673367 : 1.4 REGRESSION: Up/down arrow keys in Combo box for Win LAF opens popup portion

Details
Type:
Bug
Submit Date:
2002-04-23
Status:
Resolved
Updated Date:
2003-04-12
Project Name:
JDK
Resolved Date:
2002-08-12
Component:
client-libs
OS:
windows_nt
Sub-Component:
javax.swing
CPU:
x86
Priority:
P3
Resolution:
Fixed
Affected Versions:
1.4.0
Fixed Versions:
1.4.2 (mantis)

Related Reports
Relates:

Sub Tasks

Description

Name: gm110360			Date: 04/23/2002


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


FULL OPERATING SYSTEM VERSION : Windows NT Version 4.0


A DESCRIPTION OF THE PROBLEM :
Combo box does not behave in 1.4 the same it used to in 1.3
when “windows look and feel” is used.

If Up or Down arrows are used with combo box, the selected
item should change to the next/prev item in the list (and
it worked correctly in 1.3).

If Down arrow is pressed with 1.4 java, a pull-down list
opens. When Up arrow is pressed with 1.4 java, nothing
happens.

REGRESSION.  Last worked in version 1.3.1

STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
1. Display a Frame with a combo box that has
items "A", "B", "C"
2. Focus a combo box and select an item "B"
3. Press Up and observe that nothing happened
4. Press Down arrow and observe that pull - down list got
opened

EXPECTED VERSUS ACTUAL BEHAVIOR :
I expected selection to swith to the next item in the list
when arrow keys are used

This bug can be reproduced always.

---------- BEGIN SOURCE ----------
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
import java.util.*;

public class ComboBoxTest
{
  public static void main(String[] args)
  {
    try
    {
      UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
    }
    catch (Exception exc)
    {
    }

    ComboBoxTest comboBoxTest1 = new ComboBoxTest();

    Vector v = new Vector();
    v.add("A");
    v.add("B");
    v.add("C");

    JComboBox cb = new JComboBox(v);

    JFrame frame = new JFrame();
    frame.getContentPane().setLayout(new FlowLayout());

    frame.getContentPane().add(cb);

    frame.addWindowListener(new WindowAdapter()
    {
      public void windowClosing(WindowEvent e)
      {
        System.exit(0);
      }
    });

    frame.setBounds(100, 100, 300, 70);
    frame.setVisible(true);
  }
}
---------- END SOURCE ----------

Release Regression From : 1.3.1_03
The above release value was the last known release where this 
bug was known to work. Since then there has been a regression.

(Review ID: 139673) 
======================================================================

                                    

Comments
SUGGESTED FIX

Restore the method BasicComboBoxUI.getActionMap() to version 1.135:

    ActionMap getActionMap() {
	ActionMap map = (ActionMap)UIManager.get("ComboBox.actionMap");

	if (map == null) {
	    map = createActionMap();
	    if (map != null) {
		UIManager.getLookAndFeelDefaults().put("ComboBox.actionMap",
                                                       map);
	    }
	}
	return map;
    }

###@###.### 2002-05-08

In the overloaded WindowsComboBoxUI.installKeyboardActions, install the new Action on the instance ActionMap.
###@###.### 2002-06-24
                                     
2002-05-08
EVALUATION

This regression was introduced in the 1.4.beta. The custom Windows Up and Down arrow actions are intact but not used. The fix to 4306584 in which BasicComboBoxUI.getActionMap() will not register the "ComboBox.actionMap" on the UIManager. When the WindowsComboBoxUI tries to register its own UpAction and DownAction in the ComboBox.actionMap, it can't find it so the actions aren't registered. 
###@###.### 2002-05-08

The suggested fix is incorrect. The ActionMap cannot be shared since the HidePopupAction cannot be shared for all combo boxes. The real fix is for WindowsComboBoxUI to get the instance action map and override the "selectPrevious" and "selectNext" entries.

I also found a design flaw when I fixed this bug: In Windows, editable combo boxes should display the popup when the up and down arrow is pressed. The current implementation (which was unreachable in 1.4) the up and down arrows are a no-op.
###@###.### 2002-06-24
                                     
2002-06-24
PUBLIC COMMENTS

Fixed for 1.4.2
                                     
2004-06-10
CONVERTED DATA

BugTraq+ Release Management Values

COMMIT TO FIX:
mantis
mantis-b02

FIXED IN:
mantis
mantis-b02

INTEGRATED IN:
mantis
mantis-b02


                                     
2004-06-14



Hardware and Software, Engineered to Work Together