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

jdk 1.0.2, resizing a frame causes too many repaints

XMLWordPrintable

    • generic, x86, sparc
    • solaris_2.5.1, windows_nt

      Resizing a frame/panel causes too many repaints, thereby making the screen flicker badly. This situation is particularly aggravated if a font is set in a panel. It will cause more repaints than if the font was not set.

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

      daniel.indrigo@Canada 1997-08-13

      The window appears to get too many repaints when it is resized, but not always. It most often occurs when resizing by moving the top of the window.

      There appear to be at least two other bugs related to this problem, 4024555 and 1226539

      Following is a description of the bug and a test case from ###@###.###

      When resizing a window outwards, the contents flash and repaint
      repeatedly (oddly, it only happens when growing the window, not
      shrinking.) The problem is exacerbated when using lightweight
      components, as they are repainted with the rest of the window.
      No workarounds are currently known.

      TEST CASE
      ---------
      import java.awt.*;
      public class ResizeLW extends Frame
      {
        public ResizeLW()
        {
          setBackground(Color.red);
        }
        public static void main(String args[])
        {
          Frame f = new ResizeLW();
          f.setLayout(new FlowLayout());
          f.setBounds(10, 10, 300, 300);
          for (int i = 0; i < 10; i++)
          {
            f.add(new ColorComp(Color.blue));
            f.add(new ColorComp(Color.green));
          }
          f.setVisible(true);
        }
        static private class ColorComp extends Component
        {
          public ColorComp(Color c)
          {
            super();
            setBackground(c);
          }
          public void paint(Graphics g)
          {
            g.setColor(getBackground());
            g.fillRect(0,0,50,50);
          }
          public Dimension getPreferredSize()
          {
            return new Dimension(50, 50);
          }
        }
      }

            rraysunw Richard Ray (Inactive)
            gvanassesunw Gunter Vanasse (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: