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

Lanai - JCheckBox and JRadioButton can get into inconsitent visual state -- but recover on window refresh

XMLWordPrintable

    • 2d
    • x86_64
    • os_x

      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

            jdv Jayathirth D V
            aghaisas Ajit Ghaisas
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: