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

Win32 only: canvas doesnt read width and height values from enclosing component.

    XMLWordPrintable

Details

    • 1.0beta2
    • x86
    • solaris_2.4
    • Not verified

    Description

      >From: Patrick Chan <###@###.###>

      If you run the following program you'll find that on Unix
      it works fine - a window with a 20x20 red square appears - bu
      on Win95, you'll find a 100x100 red square. The problem is
      that the win32 implemention picks an arbitrary
      size (100x100) to create the canvas rather than use
      the width and height fields in the component (I'd like to meet
      the bonehead that did this!). There are several other components
      that exhibit this bug. Do a grep of 100 *.cpp.

      Cheers,
      Pat

      import java.awt.*;

      class Space extends Canvas {
          Color color;
          Space(Color color, int w, int h) {
      this.color = color;
      resize(w, h);
          }
          public void paint(Graphics g) {
      g.setColor(color);
      g.fillRect(0, 0, size().width, size().height);
          }
      }
      class canvasbug {
          static public void main(String args[]) {
      Frame f = new Frame();
      f.setLayout(new FlowLayout());
      Space c = new Space(Color.red, 20, 20);
      c.resize(20, 20);
      f.add(c);
      f.pack();
      f.show();
          }
      }

      Attachments

        Activity

          People

            tballsunw Tom Ball (Inactive)
            vssriniv Vijay Srinivasan (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: