Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-4924758

1.4 REGRESSION: In Motif L&F JComboBox doesn't react when spacebar is pressed

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: P3 P3
    • 6
    • 1.4.1, 1.4.2, 5.0
    • client-libs
    • beta
    • generic, x86
    • generic, windows_2000



        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)
        ======================================================================

              kizune Alexander Zuev
              jkimsunw Jeffrey Kim (Inactive)
              Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

                Created:
                Updated:
                Resolved:
                Imported:
                Indexed: