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

REGRESSION: paint is not reliably called on resize & has varied clipping applied

    XMLWordPrintable

Details

    • Bug
    • Resolution: Unresolved
    • P4
    • None
    • 1.4.0
    • client-libs
    • x86
    • windows_98

    Description

      Name: gm110360 Date: 04/09/2002


      FULL PRODUCT VERSION :
      Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.0-b92)
      Java HotSpot(TM) Client VM (build 1.4.0-b92, mixed mode)

      FULL OPERATING SYSTEM VERSION :MS Windows 98


      ADDITIONAL OPERATING SYSTEMS :Linux RedHat 7.0



      A DESCRIPTION OF THE PROBLEM :
      The new graphics handling in 1.4 introduces an
      incompatibility with earlier
      versions of Java, and inconsistency in the use of paint()
      between Microsoft
      platforms and Unix.

      If a window is resized to enlarge the window, under MS
      Windows, only
      the newly exposed part of the window is drawn in the paint
      method; the
      existing area is clipped out of the drawing and remains
      unmodified.
      Under Unix, the whole window is painted by paint().

      If the window is reduced in size, paint is not called at
      all, on either
      MS or Unix platforms. I am unable to find any documented
      way of changing
      this behaviour.

      The following code demonstrates the problems. Under 1.3 or
      earlier, a
      rectangle is drawn in the window after any window resize,
      with the previous
      contents first cleared. Under 1.4, depending on the
      platform and the nature
      of the resize, pieces of rectangle get drawn, or multiple
      rectangles get
      drawn, or no rectangles get redrawn.

      There no longer seems to be a way to have the whole window
      cleared and
      redrawn on every window resize on all hardware platforms.



      REGRESSION. Last worked in version 1.3.1

      STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
      1.Run the example program under Windows or Unix.
      2.In several steps, resize the Frame to enlarge it,
      observing the rectangles or pieces of rectangle that get
      drawn.
      3.Resize the window to reduce its size, observing the
      absence of output in the Frame and in the originating
      window.

      EXPECTED VERSUS ACTUAL BEHAVIOR :
      The Frame should have been cleared on each resize, and a
      single complete rectangle should be drawn after each resize
      operation, regardless of whether the window was enlarged or
      reduced in size.

      This bug can be reproduced always.

      ---------- BEGIN SOURCE ----------
      import java.awt.*;
      import java.awt.event.*;

      class Resize extends Frame
      {
         public static void main( String arg[] )
         {
            Resize instance = new Resize();
         }

         public Resize()
         {
            super("Try resizing this window");
            Dimension scr = Toolkit.getDefaultToolkit().getScreenSize();
            setSize(scr.width/3,scr.height/4);
            setLocation(scr.width/3,scr.height/3);
            show();
            addKeyListener( new KeyAdapter()
            {
               public void keyTyped(KeyEvent e)
               {
                  System.exit(0);
               }
            } );
         }

            /** Redraw the window contents whenever it is exposed. */
         public void paint(Graphics g)
         {
            Dimension sz = getSize();
            System.err.println("Width "+getWidth()+
               ", Height "+getHeight() );
            int height = 4*sz.height/5;
            int width = 4*sz.width/5;
            int x = (sz.width - width)/2; /* center the rectangle */
            int y = (sz.height - height)/2;

            g.drawRect(x,y,width,height);
         }
      }
      ---------- END SOURCE ----------

      CUSTOMER WORKAROUND :
      Graphics as has traditionally been practiced under Java is
      no longer possible.

      Release Regression From : 1.3.1_03
      The above release value was the last known release where this
      bug was known to work. Since then there has been a regression.

      (Review ID: 145151)
      ======================================================================

      Attachments

        Activity

          People

            dav Andrei Dmitriev (Inactive)
            gmanwanisunw Girish Manwani (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Imported:
              Indexed: