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

JPanel.setBackground(SystemColor) does not work.

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Cannot Reproduce
    • Icon: P4 P4
    • None
    • 1.1.8, 1.2.0, 1.2.2
    • client-libs
    • generic, x86
    • generic, windows_nt



      Name: rm29839 Date: 02/26/98


      JPanel.setBackground(SystemColor) does not work correctly.
      On my machine the Color.red line works correctly, but the SystemColor.control
      displays as white (my setting is beige);

      Test source follows:
      import java.awt.*;
      import java.awt.swing.*;

      class TestColor {
      public JFrame frame;

          public static void main(String[] args) {
      TestColor tst = new TestColor();
          }

          public TestColor() {
      frame = new JFrame("Test System Color ");
      frame.setSize(new Dimension(500,500));
      // try alternating these comment lines:
      // Color.red works SystemColor.control generates a white background on my machine (which is not SystemColor.control)
      //frame.getContentPane().setBackground(Color.red);
      frame.getContentPane().setBackground(SystemColor.control);
      frame.setVisible(true);
          }

      }

      This may be tied to the fact that UIManager.getColor(String) does not work correctly.
      (A JRootPane sets the color of the contentsPane to UIManager.getColor("control") which is supposed
      to be the System Color defined in the Windows Control Panel. On my machine this comes out
      as grey irrespective of the CP setting.

      Also notice the really annoying flash of white as the JFrame background gets replaced by the red background. This should not happen.
      (Review ID: 25696)
      ======================================================================

      Name: skT88420 Date: 08/18/99


      If I change colors in the NT control panel, my running swing
      application will repaint but still not reflect the new colors.
      Restarting the app will display the new system colors.
      (Review ID: 94074)
      ======================================================================


      Please read the evaluation section for sample code and description of problem.
      joutwate@eng 2000-09-19

            rraysunw Richard Ray (Inactive)
            rmandelsunw Ronan Mandel (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: