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

1.1.4G regression - repaint on a lightweight component

    XMLWordPrintable

Details

    • 1.1.6
    • x86
    • windows_nt
    • Verified

    Backports

      Description



        Name: sg39081 Date: 08/20/97


        In JDK 1.1.4G, calling repaint() on a lightweight component
        causes 2 calls to paint(). This bug has been introduced since JDK
        1.1.3.
        Ramifications: All products using lightweight components are significantly
        slower than they need to be. I believe this deserves showstopper status.

        Test case: Run the following Java application. Note that pressing
        the Button causes only one "Repaint" message, but two "Paint" messages.
        -----------------------------------------------
        import java.awt.*;
        import java.awt.event.*;
        public class DoubleRepaint extends Frame implements ActionListener
        {
          public static void main(String[] args)
          {
            (new DoubleRepaint()).setVisible(true);
          }
          public DoubleRepaint()
          {
            Button b = new Button("Press me");
            b.addActionListener(this);
            add(b, BorderLayout.SOUTH);
            _counter = new CounterComp();
            add(_counter);
            pack();
          }
          public void actionPerformed(ActionEvent e)
          {
            _counter.repaint();
          }
          private CounterComp _counter;
        }
        class CounterComp extends Component
        {
          public Dimension getPreferredSize()
          {
            return new Dimension(50, 50);
          }
          public void repaint(long tm, int x, int y, int width, int height)
          {
            System.out.println("Repaint #" + (++_repaintCount));
            super.repaint(tm, x, y, width, height);
          }
          public void paint(Graphics g)
          {
            System.out.println("Paint #" + (++_paintCount));
          }
          private int _paintCount, _repaintCount;
        }

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

        Attachments

          Issue Links

            Activity

              People

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

                Dates

                  Created:
                  Updated:
                  Resolved:
                  Imported:
                  Indexed: