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

Components don't inherit parent container's background color

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Duplicate
    • Icon: P3 P3
    • None
    • 1.1.3
    • client-libs
    • None
    • x86
    • windows_95



      Name: tb29552 Date: 09/22/97


      Components don't inherit parent container's background color,
      but they do inherit parent container's foreground color.
      Run the code supplied. The background color of the
      button and list don't change even though the Frame sets its
      background color to blue, but the foreground color
      is inherited from the Frame (white).
      On Solaris this works just fine.

      import java.awt.*;
      import java.awt.event.*;
       
      public class MyFrame extends Frame
      {
              public MyFrame() {
                      super();
                      add("North",new Button("Here is the button"));
                      List l = new List(4);
                      l.add("Item 1");
                      l.add("Item 2");
                      l.add("Item 3");
                      l.add("Item 4");
                      l.add("Item 5");
                      add("South",l);
                      setBackground(Color.blue.darker());
                      setForeground(Color.white);
       
              }
       
              public static void main(String [] args) {
                      MyFrame f = new MyFrame();
                      f.setSize(200,200);
                      f.setVisible(true);
              }
      }

      company - AT&T , email - ###@###.###
      ======================================================================

            xdengsunw Xianfa Deng (Inactive)
            tbell Tim Bell
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: