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

Frame.add(awt.Container) clips display on Win32, okay on Solaris

    XMLWordPrintable

Details

    • 1.0beta2
    • x86
    • windows_nt
    • Verified

    Description

      Win 32 only: Frame.add(awt.Component) clips display, doesn't clip on Solaris.
      Frame.add(Location, awt.Component) works fine

      Steps to reproduce:
      Compile accompanying java source
      Run Java RectAdd
      // note: compare to display on Solaris
      // note: can run Java RectAdd 1 to test Frame.add(location, java.awt.Component)

      /* Rectangle.Add() tests
       * @(#)RectAdd.java 1.2 07 Nov 1995 17:49:01
       * @author Kevin A. Smith
       *
       */

      import java.applet.Applet;
      import java.awt.*;
      import java.lang.Boolean;

      public class RectAdd extends Applet
      {
          Rectangle r1 = new Rectangle(20, 10, 60, 60);
          Rectangle r2 = new Rectangle(70, 50, 60, 60);
          Point pt = new Point(150, 150);
          int outerX = 200;
          int outerY = 200;

          public void init()
          {
             resize(400, 400);
          } // end init()


          public void paint(Graphics g)
          {
             // local variables
             Rectangle rWithPt = (Rectangle) r1.clone();
             Rectangle rWithRect = (Rectangle) r1.clone();
             Rectangle rWithInt = (Rectangle) r1.clone();

             // draw rectangle 1
             g.setColor(Color.red);
             g.fillRect(r1.x, r1.y, r1.width, r1.height);

             // draw rectangle 2
             g.setColor(Color.blue);
             g.fillRect(r2.x, r2.y, r2.width, r2.height);

             // Rectangle.add(Rectangle) test
             // should draw a yellow line around the far edges of both
             // rectangles
             g.setColor(Color.yellow);
             rWithRect.add(r2);
             g.drawRect(rWithRect.x,
                        rWithRect.y,
                        rWithRect.width,
                        rWithRect.height);

             // draw point
             g.setColor(Color.black);
             g.fillOval(pt.x - 2, pt.y - 2, 3, 3);

             // Rectangle.add(Point) test
             // should draw a magenta line around the rectangle and the
             // point
             rWithPt.add(pt);
             g.setColor(Color.magenta);
             g.drawRect(rWithPt.x, rWithPt.y, rWithPt.width, rWithPt.height);

             // draw integers
             g.setColor(Color.black);
             g.fillOval(outerX - 2, outerY - 2, 3, 3);

             // Rectangle.add(int, int) test
             // should draw a green line around the rectangle and the
             // drawn point
             rWithInt.add(outerX, outerY);
             g.setColor(Color.green);
             g.drawRect(rWithInt.x, rWithInt.y, rWithInt.width, rWithInt.height);

          } // end paint()

          public static void main(String args[])
          {
             Applet a = new RectAdd();
             a.init();
             a.start();

             AppFrame f = new AppFrame("Rectangle.add() Tests");

             // test Frame.add() variants
             if (args.length > 0 )
                 f.add("Center", a);
             else
                 f.add(a);

             f.resize(400, 400);
             f.show();
          }

      }


      /* Generic Application Frame
       * @(#)AppFrame.java 1.1 07 Nov 1995 17:17:55
       * @author Kevin A. Smith
       */

      import java.awt.Frame;
      import java.awt.Event;

      class AppFrame extends Frame
      {
          public AppFrame(String name)
          {
             super(name);
          }

          public boolean handleEvent(Event e)
          {
             if (e.id == Event.WINDOW_DESTROY)
             {
                System.exit(0);
                return true;
             }
             else
                return super.handleEvent(e);
          }
      }

      Attachments

        Activity

          People

            tballsunw Tom Ball (Inactive)
            kasmithsunw Kevin Smith (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: