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

JList and JTable constructors should clear OPAQUE_SET before calling updateUI

    XMLWordPrintable

Details

    • Bug
    • Status: Resolved
    • P4
    • Resolution: Fixed
    • 11, 15, 16
    • 17
    • client-libs
    • b17
    • generic
    • generic

    Description

      The JList and JTable constructors both set the opaque property of the component to true using setOpaque(true), which has the side-effect of setting the OPAQUE_SET flag to true, which has the effect of preventing setUIProperty from clearing the property. As the opaque property was not set by the client program, setUIProperty should work.

      package test;

      import javax.swing.JList;
      import javax.swing.JTable;
      import javax.swing.LookAndFeel;
      import javax.swing.SwingUtilities;

      public class TestOpaqueListTable
      {
          public TestOpaqueListTable()
          {
              JList list = new JList();
              LookAndFeel.installProperty(list, "opaque", false);
              if (list.isOpaque()) {
                  System.err.println("Failed to clear JList opaque");
              }
              JTable table = new JTable();
              LookAndFeel.installProperty(table, "opaque", false);
              if (table.isOpaque()) {
                  System.err.println("Failed to clear JTable opaque");
              }
          }

          public static void main(String[] args)
          {
              SwingUtilities.invokeLater(TestOpaqueListTable::new);
          }
      }

      Attachments

        Issue Links

          Activity

            People

              trebari Tejpal Rebari (Inactive)
              alans Alan Snyder
              Votes:
              0 Vote for this issue
              Watchers:
              5 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: