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

1.1.4G - repaints on lightweight components are sometimes dropped

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: P2
    • Resolution: Fixed
    • Affects Version/s: 1.1.4
    • Fix Version/s: 1.1.5
    • Component/s: client-libs
    • Labels:
    • Subcomponent:
    • Resolved In Build:
      1.1.5
    • CPU:
      x86
    • OS:
      windows_nt
    • Verification:
      Verified

      Backports

        Description




        Name: sg39081 Date: 08/20/97


        In JDK 1.1.4G -
        When several repaints() are issued together, occasionally one is
        dropped. It's infrequent enough to not be obvious, but some of our
        components can reproduce this bug extremely easily.
        I've been unable to reproduce the problem on Solaris 1.1.2, but
        have repro'd it on Windows on JDK 1.1.4G and 1.1.3 final.

        The following source code will reproduce the problem. Run the
        application, and hold down the "tab" key. The window will gradually
        repaint from top to bottom. Periodically, individual lines fail
        to be repainted.
        The frequency with which repaints are dropped varies from machine
        to machine, and from run to run (and moment to moment).
        This bug is likely causing many mysterious and hard-to-reproduce
        refresh problems in our products - it may qualify as a showstopper.

        import java.awt.*;
        import java.awt.event.*;
        public class RepaintBug extends Frame
        {
          static public void main(String[] args)
          {
            (new RepaintBug()).setVisible(true);
          }
          public RepaintBug()
          {
            add(new TestComponent());
            pack();
          }
        }
        class TestComponent extends Component
        {
          public TestComponent()
          {
            enableEvents(AWTEvent.KEY_EVENT_MASK);
          }
          public boolean isFocusTraversable()
          {
            return true;
          }
          public Dimension getPreferredSize()
          {
            return new Dimension(50, _LINE_COUNT);
          }
          public void paint(Graphics g)
          {
            Dimension d = getSize();
            if (_lineNumber < 0) // Quick hack for first paint()
              g.setColor(_colors[1 - _colorIndex]);
            else
              g.setColor(_colors[_colorIndex]);
            g.fillRect(0, 0, d.width, d.height);
          }
          protected void processKeyEvent(KeyEvent e)
          {
            if (e.getID() == KeyEvent.KEY_TYPED)
            {
              // Repaint a bunch of lines
              for (int i = 0; i < _LINES_REDRAWN_AT_A_TIME; i++)
                repaint(0, _lineNumber++, getSize().width, 1);
              if (_lineNumber >= _LINE_COUNT)
              {
                _lineNumber = 0; // Back to the first line
                _colorIndex++; // and switch colors
                if (_colorIndex == _colors.length)
                  _colorIndex = 0;
              }
            }
          }
          private int _colorIndex = 0;
          private int _lineNumber = -1;
          static private final Color[] _colors = {Color.red, Color.green};
          static private int _LINE_COUNT = 600;
          static private int _LINES_REDRAWN_AT_A_TIME = 25;
        }

        company - Oracle , email - ###@###.###
        ======================================================================

        jeff.hsiao@Eng 1997-10-17

        I can reproduce this bug on WinNT.

          Attachments

            Issue Links

              Activity

                People

                Assignee:
                cchongsunw Creighton Chong (Inactive)
                Reporter:
                sgoodsunw Sheri Good (Inactive)
                Votes:
                0 Vote for this issue
                Watchers:
                0 Start watching this issue

                  Dates

                  Created:
                  Updated:
                  Resolved:
                  Imported:
                  Indexed: