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

Solaris only: background of windows is incorrectly set

XMLWordPrintable

    • sparc
    • generic

      When a component changes its background, the Motif awt peers incorrectly
      propagates the background change to all child windows. Instead, it should
      only propagate to ones that did not specify a background explicitly and
      inherited their background from the changed parent.

      Reproduce by:

      import java.awt.*;
      import java.applet.*;

      class MyCanvas extends Canvas {
          public void paint(Graphics g) {
          }

          public void update(Graphics g) {
          }
      }

      public class BG extends Applet {

          public void init() {
      setLayout(null);
      resize(300, 300);

      Canvas c1 = new MyCanvas();
      add(c1);
      c1.reshape(20, 20, 40, 40);

      Canvas c2 = new MyCanvas();
      add(c2);
      c2.reshape(240, 240, 40, 40);

      c1.setBackground(Color.red);
      c2.setBackground(Color.blue);

          }

          public boolean handleEvent(Event e) {

      if (e.id == Event.MOUSE_DOWN) {
      setBackground(Color.yellow);
      return true;
      }
      return false;
          }
      }

      This is available for a while as http://wombat.eng/~rberlin/BG.html

      The applet correctly comes up with red and blue squares on a gray background.
      Click anywhere in the applet and it will all go yellow, including the
      child canvases.

      This was reproduced with a current (minus a few days) JDK1.1 workspace
      and appletviewer.

      By no-oping the paint and update methods, we can see what color the
      window system is painting the windows on expose.

      I tried this on a 1.0.1 Win32s platform and got the correct behaviour
      (ignoring the effects of bug 1246765, which also affects backgrounds).

      [2 May 96 a]

            gsaab Georges Saab
            duke J. Duke
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: