-
Bug
-
Resolution: Fixed
-
P4
-
1.2.0, 1.2.1
-
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)
======================================================================
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)
======================================================================
- duplicates
-
JDK-4174386 PrintJob.getGraphics().drawString(String,int,int) doesn't work: 1.1 printing api
- Closed
-
JDK-4191824 Text does not print using printjob; prints only the graphics
- Closed
-
JDK-4233190 Print Text using PrintJob doesn't work with 1.2.1, but works with 1.1.7/Swing1.1
- Closed