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

by a resize of a applet with the mouse ,the paint method is called several times

    XMLWordPrintable

    Details

    • Subcomponent:
    • CPU:
      sparc
    • OS:
      solaris_2.4

      Description

      import java.applet.*;
      import java.awt.*;

      public class PaintTest extends Applet {
          protected PanelObject panel;
          protected int counter;
          public PaintTest() {
              panel = new PanelObject();
              setLayout(new BorderLayout());
              add("Center", panel);
              add("South", new Button("button1"));
          }
          public void paint(Graphics g) {
              System.out.println("paint parent" + "counter" + counter);
              counter++;
          }
          public boolean action(Event evt, Object arg) {
              System.out.println("action");
              repaint();
              return true;
          }
      }

      class PanelObject extends Panel {
          protected int counter;
          PanelObject() {
          }
          
          public void paint(Graphics g) {
              System.out.println("paint child" + " counter" + counter);
              counter++;
          }
      }


      > appletviewer update.html
      status: applet loaded
      status: applet initialized
      status: applet started
      paint child counter0


      // when I do the first resize with the mouse I got this printout.
      paint child counter1
      paint parentcounter0
      paint parentcounter1
      paint child counter2
      paint parentcounter2
      paint parentcounter3
      paint parentcounter4
      paint child counter3

      I think it's not a correct output, the paint method should be called only once.

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              duke J. Duke (Inactive)
              Reporter:
              duke J. Duke (Inactive)
              Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved:
                Imported:
                Indexed: