FULL PRODUCT VERSION :
java version "1.8.0_45"
Java(TM) SE Runtime Environment (build 1.8.0_45-b15)
Java HotSpot(TM) 64-Bit Server VM (build 25.45-b02, mixed mode)
ADDITIONAL OS VERSION INFORMATION :
Windows Server 2008 R2 Enterprise
64 bit Operating System
A DESCRIPTION OF THE PROBLEM :
This issue is seen only with jre8u45.The issue is on the traversal of focus.
When we have a bunch of radio buttons added to a button group focus does not navigate to second radio button on hitting a tab
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
1)Just write a Simple Java Program with multiple radio buttons and run the same when he hit tab button,the focus does not navigate to second radio button
This was working perfectly fine with jre7,issue seen only in jre8u45
Simple Java Program:
import java.awt.FlowLayout;
import javax.swing.ButtonGroup;
import javax.swing.JFrame;
import javax.swing.JRadioButton;
import javax.swing.SwingUtilities;
public class SwingJRadioButtonDemo extends JFrame {
public SwingJRadioButtonDemo() {
super("Swing JRadioButton Demo");
JRadioButton option1 = new JRadioButton("Linux");
JRadioButton option2 = new JRadioButton("Windows");
JRadioButton option3 = new JRadioButton("Macintosh");
ButtonGroup group = new ButtonGroup();
group.add(option1);
group.add(option2);
group.add(option3);
setLayout(new FlowLayout());
add(option1);
add(option2);
add(option3);
pack();
}
public static void main(String[] args) {
SwingUtilities.invokeLater(new Runnable() {
@Override
public void run() {
new SwingJRadioButtonDemo().setVisible(true);
}
});
}
}
EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
On pressing the tab button Focus should ideally navigate from 1st radio button to second and so forth
ACTUAL -
Currently on pressing tab focus is only on first radio button,focus does not move on pressing tab,one has to use arrow keys to navigate.
Pressing Tab works perfectly fine with other component like JCheckBox,issue is seen only with JRadioButton
REPRODUCIBILITY :
This bug can be reproduced always.
---------- BEGIN SOURCE ----------
import java.awt.FlowLayout;
import javax.swing.ButtonGroup;
import javax.swing.JCheckBox;
import javax.swing.JFrame;
import javax.swing.JRadioButton;
import javax.swing.SwingUtilities;
public class SwingJRadioButtonDemo extends JFrame {
public SwingJRadioButtonDemo() {
super("Swing JRadioButton Demo");
JRadioButton option1 = new JRadioButton("Linux");
JRadioButton option2 = new JRadioButton("Windows");
JRadioButton option3 = new JRadioButton("Macintosh");
JCheckBox option4 = new JCheckBox("Macintosh");
JCheckBox option5 = new JCheckBox("Windows");
ButtonGroup group = new ButtonGroup();
group.add(option1);
group.add(option2);
group.add(option3);
group.add(option4);
group.add(option5);
setLayout(new FlowLayout());
add(option1);
add(option2);
add(option3);
add(option4);
add(option5);
pack();
}
public static void main(String[] args) {
SwingUtilities.invokeLater(new Runnable() {
@Override
public void run() {
new SwingJRadioButtonDemo().setVisible(true);
}
});
}
}
---------- END SOURCE ----------