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

2D Renderings on a frame are not repainted properly when the frame is resized

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Not an Issue
    • Icon: P3 P3
    • 6
    • 6
    • client-libs
    • generic
    • generic

      I am extending the frame class and overriding the paint() method of the frame class to draw some 2D graphics on to the frame's graphics context. This is an empty frame. I am drawing a line diagonally from the Top-Left corner of the frame to the Bottom-right corner. The coordinates passed to the drawLine() method are dynamic in the sense that they are calculated from the frame's size.
      On Solaris - JDK1.4+:
      When I resize the frame in the outward direction, a new line is drawn from 0,0 to the new bottom-right corner of the frame but the line that was drawn previously is not erased. This happens as long as the frame is resized and I could see so many lines being drawn on the frame. The lines are not at all erased unless the frame is overlapped by another window or is minimized. This works perfectly on JDK1.3 and 1.3.1 and appears to be a regression on JDK1.4

      On Win32 - JDK1.4+:
      When I resize the frame, the newline is not drawn from 0,0 (as specified in the drawLine() method) but it starts from the coordinate position where the previous rendering operation completed. That is, from the previous bottom-right corner of the frame to the new bottom-right corner of the resized frame. That too, it is not drawn as a straight line and it follows the path of resize operation and hence looks like a sinusoidal wave. As I mentioned before, this works fine on JDK1.3 & 1.3.1.

      I also tried with a Rectangle and I could notice the same behavior. I have attached a sample code. Execute the sample code on any JDK1.4+ build and you would notice the above behavior. I have also attached the screenshot of the above scenarios taken on Win XP and Solaris 8.

      When the frame is resized in the inward direction, the paint() method itself is not getting called and I have already filed a bug on that (4874509).
      I tried overriding the update() method of the frame to clear the rendering but the update method is not at all getting called on JDK1.4+.
      This is not reproducible with Canvas & JFrame.

            yan Yuri Nesterenko (Inactive)
            pmohansunw Praveen Mohan (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: