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

Default text printing colour on win32 is white (invisible) : 1.1 printing API

XMLWordPrintable

    • 2d
    • kestrel
    • x86
    • windows_95, windows_nt

      Name: krT82822 Date: 01/14/99

      original synopsis (user's): "Graphics.drawString fails if Graphics.setFont(=
      ) was used before (when Printing)"

      (since setFont() apparently not significant, have removed that from synopsi=
      s)

      Running this application does:
      - print "HelloWorld!" with JRE 1.1.7b
      - print an empty page with JRE 1.2final

      If you do not use "setFont" then the string will be displayed
      in the default font.

      Displaying the string in a Frame by overriding "paint" works
      correctly, too.

      ---- cut here ----
      import java.awt.*;
      import java.util.*;

      public class PrintBug {
        public static void main( String argv[] ) {
          Frame f =3D new Frame( "Hello World" );
          f.show();
          PrintJob pj =3D Toolkit.getDefaultToolkit().getPrintJob( f, "Hello", nu=
      ll );
          Graphics pg =3D pj.getGraphics();

          // this line causes the trouble
          pg.setFont( new Font( "Serif", Font.BOLD, 18 ) );

          pg.drawString( "HelloWorld!", 50, 50 );
          pg.dispose();
          pj.end();
        }
      }
      ---- and here ----
      (Review ID: 48208)
      ======================================================================

            prr Philip Race
            kryansunw Kevin Ryan (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: