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

Keyboard Navigation in RadioButton-Group Not Possible

    Details

    • Type: Bug
    • Status: Closed
    • Priority: P4
    • Resolution: Duplicate
    • Affects Version/s: 9, 10, 11, 12, 13, 14
    • Fix Version/s: tbd
    • Component/s: client-libs
    • Labels:
      None
    • Subcomponent:
    • Introduced In Version:
      9
    • OS:
      windows

      Description

      Navigation/selection with keyboard of each JRadioButton in a ButtonGroup is not possible when a Synth based Look and Feel like Nimbus is used. The test below demonstrates the issue- the issue was introduced with Java 9. The relevant code is in located in BasicRadioButtonUI - it looks like KeyHandler and actions haven't been ported to SynthRadioButtonUI for some reason.


      public class RadioButtonGroupTest extends JFrame
      {
        public RadioButtonGroupTest()
        {
          setName(getClass().getSimpleName());
          setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
          setLayout(new FlowLayout());

          final JRadioButton one = new JRadioButton("one");
          final JRadioButton two = new JRadioButton("two");
          final JRadioButton three = new JRadioButton("three");
          add(one);
          add(two);
          add(three);
          add(new JButton("hello"));

          final ButtonGroup grp = new ButtonGroup();
          grp.add(one);
          grp.add(two);
          grp.add(three);
          setSize(300, 400);
          setLocationRelativeTo(null);
          setVisible(true);
        }
        
        public static void main(final String[] args) throws Exception
        { UIManager.setLookAndFeel("javax.swing.plaf.nimbus.NimbusLookAndFeel");
          SwingUtilities.invokeLater(() -> new RadioButtonGroupTest());
        }
      }

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                psadhukhan Prasanta Sadhukhan
                Reporter:
                wzberger Wolfgang Zitzelsberger
              • Votes:
                0 Vote for this issue
                Watchers:
                3 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: