JDK-4924758 : 1.4 REGRESSION: In Motif L&F JComboBox doesn't react when spacebar is pressed
  • Type: Bug
  • Component: client-libs
  • Sub-Component: javax.swing
  • Affected Version: 1.4.1,1.4.2,5.0
  • Priority: P3
  • Status: Resolved
  • Resolution: Fixed
  • OS: generic,windows_2000
  • CPU: generic,x86
  • Submitted: 2003-09-18
  • 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.
Other JDK 6
1.4.2_08Fixed 6 betaFixed
Related Reports
Duplicate :  
Relates :  
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
CONVERTED DATA BugTraq+ Release Management Values COMMIT TO FIX: mustang FIXED IN: mustang INTEGRATED IN: mustang
14-09-2004

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, ======================================================================
14-09-2004

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 ======================================================================
06-11-2003