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

XAWT: painting inconsistency

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: P3 P3
    • 5.0
    • 5.0
    • client-libs
    • None
    • b26
    • generic
    • linux



      Name: rpR10076 Date: 09/12/2003


      Please see included test. It consists of one
      frame and a canvas.
      When run with MToolkit, or WToolkit, it first
      appears red. With XAWT, it first appears grey
      and only turns red if you resize the window.
      It is arguable whether the test is valid (it
      isn't a good thing to set background within
      paint() method), but I copied it from a real
      test case for another bug, so I believe people
      do that, and they may be disappointed with
      the fact that XAWT behaves inconsistently in
      this situation.

      === test program ===
      import java.awt.*;

      public class PaintBug extends Frame {
          private PaintBugCanvas fpc;

          public PaintBug() {
              fpc = new PaintBugCanvas();
              add(fpc);
          }

          public static void main(String[] args) {
              PaintBug fp = new PaintBug();
              fp.pack();
              fp.show();
          }
      }

      class PaintBugCanvas extends Canvas {

          public PaintBugCanvas() {
              setSize(200,200);
          }

          public void paint(Graphics g) {
              setBackground(Color.red);
              g.drawString("I should be red", 20, 20);
          }
      }
      === test program ===

      ======================================================================

            yan Yuri Nesterenko
            prssunw Prs Prs (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: