United StatesChange Country, Oracle Worldwide Web Sites Communities I am a... I want to...
JDK-4924758 : 1.4 REGRESSION: In Motif L&F JComboBox doesn't react when spacebar is pressed

Details
Type:
Bug
Submit Date:
2003-09-18
Status:
Resolved
Updated Date:
2004-10-13
Project Name:
JDK
Resolved Date:
2004-09-14
Component:
client-libs
OS:
generic,windows_2000
Sub-Component:
javax.swing
CPU:
x86,generic
Priority:
P3
Resolution:
Fixed
Affected Versions:
1.4.1,1.4.2,5.0
Fixed Versions:

Related Reports
Backport:
Backport:
Duplicate:
Relates:

Sub Tasks

Description

Name: jk109818			Date: 09/18/2003


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

FULL OS VERSION :
Microsoft Windows 2000 [Version 5.00.2195]

A DESCRIPTION OF THE PROBLEM :
In Motif L&F JComboBox doesn't react when spacebar is pressed. Spacebar used for making selection in combobox as javadocs say. In Java (Metal) L&F it works fine - when I press spacebar popup window is being hidden, in Motif L&F popup window remains visible without any changes.

STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
Compile and run my class. Press Arrow Down key when combobox has focus, than try to press Spacebar. If you want to see proper behavior comment out Motif L&F setting in 'main' method.

EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
When you press spacebar key popup list should disappear.
ACTUAL -
When you press spacebar key popup list remains visible.

REPRODUCIBILITY :
This bug can be reproduced always.

---------- BEGIN SOURCE ----------
/**
 * Check JCombobox key actions.
 */

import	java.awt.*;
import	java.awt.event.*;

import	javax.swing.*;


public	class	ChkCBkeys	{

private	JFrame		frMain;
private	JComboBox	jcbTest;


// Top entry

public	static	void	main( String args[] )
{

// Set Motif L&F
// Comment this block to see proper behavior in Metal L&F

	try	{

		UIManager.setLookAndFeel( "com.sun.java.swing.plaf.motif.MotifLookAndFeel" );

		}
	catch( UnsupportedLookAndFeelException e )	{
		System.out.println( "Motif Look & Feel not supported on this platform." );
		System.exit(0);
							}
	catch( IllegalAccessException e )		{
		System.out.println( "Motif Look & Feel could not be accessed." );
		System.exit(0);
							}
	catch( ClassNotFoundException e )		{
		System.out.println( "Motif Look & Feel could not found." );
		System.exit(0);
							}
	catch( InstantiationException e )		{
		System.out.println( "Motif Look & Feel could not be instantiated." );
		System.exit(0);
							}

	new ChkCBkeys();
}


// Constructor

private	ChkCBkeys()
{
Container	cntMain;


	frMain = new JFrame( "Test JComboBox" );
	cntMain = frMain.getContentPane();

// Way to exit

	frMain.addWindowListener( new WindowAdapter()	{

		public	void	windowClosing( WindowEvent evt )
		{
			frMain.dispose();
			System.exit( 0 );
		}

							} );

	jcbTest = new JComboBox( new String[] { "one", "two", "three" } );

	cntMain.add( new JLabel( "Select item by spacebar" ), BorderLayout.NORTH );
	cntMain.add( jcbTest, BorderLayout.CENTER );

	frMain.pack();
	frMain.setLocation( 200, 200 );

	frMain.show();

}
				}

---------- END SOURCE ----------

CUSTOMER SUBMITTED WORKAROUND :
Process spacebar key in subclasses.

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

(Incident Review ID: 206966) 
======================================================================

                                    

Comments
EVALUATION

Currently under investigation. Serious bug that affects menu functionality in Motif LAF.

###@###.### 2003-09-30

Name: azC76091			Date: 11/06/2003


We do not adding the correct action keys to the Motif L&F's ActionMap.
The idea of suggested fix is to add such keys.
###@###.###                11/06/2003
======================================================================
                                     
2003-11-06
SUGGESTED FIX



Name: azC76091			Date: 11/06/2003



------- MotifLookAndFeel.java -------
*** /tmp/sccs.gGayWS	Thu Nov  6 20:23:15 2003
--- MotifLookAndFeel.java	Thu Nov  6 18:54:11 2003
***************
*** 1086,1092 ****
  		     "DOWN", "selectNext",
  		  "KP_DOWN", "selectNext",
  		       "UP", "selectPrevious",
! 		    "KP_UP", "selectPrevious"
  	      }),
  
              "TextField.caretForeground", black,
--- 1086,1095 ----
  		     "DOWN", "selectNext",
  		  "KP_DOWN", "selectNext",
  		       "UP", "selectPrevious",
! 		    "KP_UP", "selectPrevious",
!                     "SPACE", "spacePopup",
!                     "ENTER", "enterPressed"
! 
  	      }),
  
              "TextField.caretForeground", black,

======================================================================
                                     
2004-09-14
CONVERTED DATA

BugTraq+ Release Management Values

COMMIT TO FIX:
mustang

FIXED IN:
mustang

INTEGRATED IN:
mustang


                                     
2004-09-14



Hardware and Software, Engineered to Work Together