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

drawbytes does not use the current font

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Duplicate
    • Icon: P4 P4
    • None
    • 1.1.8
    • client-libs
    • sparc
    • solaris_2.5.1



      Name: gsC80088 Date: 03/04/99


      Sun Microsystems Inc. SunOS 5.6 Generic August 1997

      arthur$ pwd
      /net/home/cbruno/aioli/java/classes
      arthur$ ls
      Bug.java Workaround.java bug.html
      arthur$ javac *.java
      arthur$ java -version
      java version "1.1.6"
      arthur$ arch
      sun4
      arthur$ appletviewer bug.html
      arthur$ appletviewer bug.html
      arthur$ more bug.html
      <HTML>
        <HEAD>
          <TITLE>
          </TITLE>
        </HEAD>
        <BODY>
          <APPLET
            WIDTH=450 HEIGHT=170
            CODE="Bug.class">
          </APPLET>
          <APPLET
            WIDTH=450 HEIGHT=170
            CODE="Workaround.class">
          </APPLET>
        </BODY>
      </HTML>
      arthur$
      arthur$ more Bug.java
      import java.applet.Applet;
      import java.awt.Graphics;

      public final class Bug extends Applet {

          public void paint(Graphics g) {
              update(g);
          }

          public void update(Graphics g) {
              final java.awt.Font theBigFont = new java.awt.Font("Serif",java.awt.Font
      .BOLD,22);
              final java.awt.Font theSmallFont = new java.awt.Font("Monospaced",java.a
      wt.Font.PLAIN,11);
              g.setFont(theBigFont);
              byte[] theBytes = ("drawBytes " + theBigFont.toString()).getBytes();
              g.drawBytes(theBytes,0,theBytes.length,0,50);
              g.setFont(theSmallFont);
              theBytes = ("drawBytes " + theSmallFont.toString()).getBytes();
              g.drawBytes(theBytes,0,theBytes.length,0,100);
              g.setFont(theBigFont);
              theBytes = ("drawBytes " + theBigFont.toString()).getBytes();
              g.drawBytes(theBytes,0,theBytes.length,0,150);
          }
        
      }
      arthur$
      arthur$ more Workaround.java
      import java.applet.Applet;
      import java.awt.Graphics;

      public final class Workaround extends Applet {

          public void paint(Graphics g) {
              update(g);
          }

          public void update(Graphics g) {
              final java.awt.Font theBigFont = new java.awt.Font("Serif",java.awt.Font
      .BOLD,22);
              final java.awt.Font theSmallFont = new java.awt.Font("Monospaced",java.a
      wt.Font.PLAIN,11);
              g.setFont(theBigFont);
              g.drawString("drawString " + theBigFont.toString(),0,50);
              g.setFont(theSmallFont);
              g.drawString("drawString " + theSmallFont.toString(),0,100);
              g.setFont(theBigFont);
              g.drawString("drawString " + theBigFont.toString(),0,150);
          }
        
      }
      arthur$
      (Review ID: 43505)
      ======================================================================

            ehawkessunw Eric Hawkes (Inactive)
            gstone Greg Stone
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: