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

The color returned by CheckBox.interiorBackground is incorrect

XMLWordPrintable

    • Fix Understood
    • x86_64
    • windows

      ADDITIONAL SYSTEM INFORMATION :
      Windows 11;
      jdk-18.0.1.1

      A DESCRIPTION OF THE PROBLEM :
      On Windows 11 the checkboxes have 2 internal background colors. One when it's checked and onether one when it's unchecked.

      The checkboxes have a blue interior background color on the checked state. But the color returned by "UIManager.getColor("CheckBox.interiorBackground")" method is a white-grey.

      Maybe it should be two keys: "checkedInternalBackground" and "uncheckedInternalBackground".


      STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
      Run the code from "Source code for an executable test case" section.
      The background color of the checkbox is blue in the UI.
      The color printed in the console is 255, 255, 255



      ---------- BEGIN SOURCE ----------
      package com.oxygenxml.sampleMavenProject;

      import java.awt.Color;
      import java.awt.GridBagConstraints;
      import java.awt.GridBagLayout;

      import javax.swing.JCheckBox;
      import javax.swing.JFrame;
      import javax.swing.JPanel;
      import javax.swing.UIManager;

      public class CheckBoxExample {
      CheckBoxExample() {
      JFrame f = new JFrame("CheckBox Example");
      JCheckBox checkBox1 = new JCheckBox("A", true);

      JPanel panel = new JPanel();
      panel.setLayout(new GridBagLayout());
      f.add(panel);

      GridBagConstraints gbc = new GridBagConstraints();
      gbc.gridx = 0;
      gbc.gridy = 0;
      panel.add(checkBox1, gbc);

      f.setSize(400, 400);
      f.pack();
      f.setLayout(null);
      f.setVisible(true);
      }

      public static void main(String args[]) {
      try {
      UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());

      Color color = UIManager.getColor("CheckBox.interiorBackground");
      System.out.println("color: "+ color);
      } catch (Exception e) {
      e.printStackTrace();
      }

      new CheckBoxExample();
      }
      }
      ---------- END SOURCE ----------

      FREQUENCY : always


        1. 8289539_Windows11.png
          3 kB
          Tejesh R
        2. Capture_Window10.PNG
          5 kB
          Praveen Narayanaswamy
        3. CheckBoxExample.java
          0.9 kB
          Praveen Narayanaswamy

            tr Tejesh R
            webbuggrp Webbug Group
            Votes:
            0 Vote for this issue
            Watchers:
            6 Start watching this issue

              Created:
              Updated: