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

setFont() in Applet paint() causes infinite loop if called more than once(win32)

    Details

    • Subcomponent:
    • CPU:
      x86
    • OS:
      windows_95, windows_nt

      Description

      orig synopsis: "SETFONT IF USED IN THE PAINT METHOD OF APPLET"

      Name: diC59631 Date: 05/11/98


      import java.awt.*;
      public class webpage extends java.applet.Applet
      {
              int x = 10 , y = 10;
              public void update(Graphics g)
              {
                      paint(g);
              }
              public void paint(Graphics g)
              {
                      setFont(new Font("TimesRoman",Font.BOLD,20));
                      g.drawString("abc" , x++ , y++);
              }
      }
      /* THIS PROGRAM SHOULD DISPLAY THE STRING "ABC" AT
      (11,11). BUT SINCE I HAVE SET THE FONT IN
      THE PAINT METHOD , IT GOES IN AN INFINITE
      LOOP , AND DISPLAYS THE STRING "ABC" AT
      DIFFERENT INCREMENTING LOCATIONS.

      IF I HAD CALLED THE PAINT METHOD USING A
      THREAD , THEN THE THREAD'S SLEEP DURATION
      WOULD HAVE NO EFFECT AS THE PAINT METHOD
      IS IN AN INFINITE LOOP.

      THE PROBLEM IS MAINLY BECAUSE I HAVE SET
      THE FONT IN THE PAINT METHOD.
      */
      (Review ID: 29935)
      ======================================================================

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                son Oleg Sukhodolsky (Inactive)
                Reporter:
                dindrigo Daniel Indrigo (Inactive)
              • Votes:
                0 Vote for this issue
                Watchers:
                0 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved:
                  Imported:
                  Indexed: