JCheckBox and JRadioButton components have image and text rendering.
For bug isolation, I have set text to empty string. So, this has to do with image rendering sequence.
Steps to reproduce -
Launch the test program given here and click on JCheckBox and JRadioButton alternately. Keep on observing state of these components on every click. Sometime, the state (checked/unchecked) image gets into inconsistent state.
Do a refresh by switching focus away from the test window and get back to it. The checked/unchecked state recovers.
Test program ------
import java.awt.FlowLayout;
import javax.swing.JFrame;
import javax.swing.JRadioButton;
import javax.swing.JPanel;
import javax.swing.JCheckBox;
class CheckBoxTest extends JFrame {
static JFrame f;
public static void main(String[] args)
{
f = new JFrame();
f.setSize(300, 300);
f.setLayout(new FlowLayout());
JCheckBox c = new JCheckBox("");
JRadioButton b = new JRadioButton("");
JPanel p = new JPanel();
p.add(b);
p.add(c);
f.add(p);
f.setVisible(true);
}
}
Tip : I was able to reproduce this using mouse click on touchpad of my macbook pro.
Sometimes it takes a while to reach this inconsistent state with this program.
Same issue can be seen with SwingSet2- https://bugs.openjdk.java.net/browse/JDK-8236592
For bug isolation, I have set text to empty string. So, this has to do with image rendering sequence.
Steps to reproduce -
Launch the test program given here and click on JCheckBox and JRadioButton alternately. Keep on observing state of these components on every click. Sometime, the state (checked/unchecked) image gets into inconsistent state.
Do a refresh by switching focus away from the test window and get back to it. The checked/unchecked state recovers.
Test program ------
import java.awt.FlowLayout;
import javax.swing.JFrame;
import javax.swing.JRadioButton;
import javax.swing.JPanel;
import javax.swing.JCheckBox;
class CheckBoxTest extends JFrame {
static JFrame f;
public static void main(String[] args)
{
f = new JFrame();
f.setSize(300, 300);
f.setLayout(new FlowLayout());
JCheckBox c = new JCheckBox("");
JRadioButton b = new JRadioButton("");
JPanel p = new JPanel();
p.add(b);
p.add(c);
f.add(p);
f.setVisible(true);
}
}
Tip : I was able to reproduce this using mouse click on touchpad of my macbook pro.
Sometimes it takes a while to reach this inconsistent state with this program.
Same issue can be seen with SwingSet2- https://bugs.openjdk.java.net/browse/JDK-8236592
- blocks
-
JDK-8236592 Checkbox doesn't work for JList prefix in SwingSet2 demo
-
- Resolved
-
- relates to
-
JDK-8247332 Checkbox reaches inconsistent state on tap to click
-
- Resolved
-