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

GTK/Synth ComboBox focus problems

    Details

      Description

      It is a problem that SynthArrowButton created by SynthComboBoxUI is able to gain a focus and behaves partly like a separate component.

      Problem from the user's point of view:

      0) run the following code snippet
      1) press Alt+t
      2) press down arrow key and choose some item
      3) Press Enter

      --> only Button (SynthComboBoxUI) blinks and combobox remains open. So user is not able to use keyboard in combination with labelFor to choose an item from the JComboBox.

      Or just attach a FocusListener to the 'c' combobox, run the snippet and just keep pressing TAB. Nothing happend under Metal L&F which is right but which is not the case with GTK L&F since focus is traversed between SynthArrowButton and JComboBox components (which should behave as one component).


      public static void main(String[] args) throws Exception {
          UIManager.setLookAndFeel("com.sun.java.swing.plaf.gtk.GTKLookAndFeel");
          SwingUtilities.invokeLater(new Runnable() {
              public void run() {
                  JFrame f = new JFrame();
                  f.setLayout(new FlowLayout());
                  f.setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE);
                  JComboBox c = new JComboBox();
                  c.addItem("Test 1");
                  c.addItem("Test 2");
                  c.addItem("Test 3");
                  JLabel l = new JLabel("Test: ");
                  l.setDisplayedMnemonic('T');
                  l.setLabelFor(c);
                  f.add(l);
                  f.add(c);
                  f.pack();
                  f.setVisible(true);
              }
          });
      }

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                gromainsunw Guy Romain (Inactive)
                Reporter:
                duke J. Duke (Inactive)
              • Votes:
                0 Vote for this issue
                Watchers:
                0 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved:
                  Imported:
                  Indexed: