ellandrd
asked on
printing problem very urgent
hi,
i have the following code to print:
private void Print() {
Frame f = new Frame( "Printing" );
f.pack();
PrintJob pj = f.getToolkit().getPrintJob ( f, "Printing Results", null );
if ( pj != null ) {
g = pj.getGraphics();
fnt = new Font( "Trebuchet MS", Font.PLAIN, 14 );
g.setFont(fnt);
g.drawString(textareaEng.g etText() + "\n\n" + textareaFre.getText() + "\n\n" + textareaSol.getText(), 30, 30 );
g.dispose();
pj.end();
}
}
but the problem is when its printed, i get small squares where there should be a new line!
if i was to use JDK1.5 which im currently using for writing program everything works perfect cos i use replaceAll(), but my client is running JDK1.3 and replaceAll only works for JDK1.4 and higher. (to my knowledge)
i need to be able to overcome this and print newlines where "\n" is instead of squares...
so say
textareaEng = "hello world";
textareafre = "bonjour monde";
textareaSol = "sosol lf";
using my code above would print
hello world □□ bonjour monde □□ sosol lf
but i want it to print out so it looks like :
hello world
bonjour monde
sosol lf
this is very urgent
thanks sean
i have the following code to print:
private void Print() {
Frame f = new Frame( "Printing" );
f.pack();
PrintJob pj = f.getToolkit().getPrintJob
if ( pj != null ) {
g = pj.getGraphics();
fnt = new Font( "Trebuchet MS", Font.PLAIN, 14 );
g.setFont(fnt);
g.drawString(textareaEng.g
g.dispose();
pj.end();
}
}
but the problem is when its printed, i get small squares where there should be a new line!
if i was to use JDK1.5 which im currently using for writing program everything works perfect cos i use replaceAll(), but my client is running JDK1.3 and replaceAll only works for JDK1.4 and higher. (to my knowledge)
i need to be able to overcome this and print newlines where "\n" is instead of squares...
so say
textareaEng = "hello world";
textareafre = "bonjour monde";
textareaSol = "sosol lf";
using my code above would print
hello world □□ bonjour monde □□ sosol lf
but i want it to print out so it looks like :
hello world
bonjour monde
sosol lf
this is very urgent
thanks sean
Does
g.drawString(textareaEng.g etText() + "\n\r\n\r" + textareaFre.getText() + "\n\r\n\r" + textareaSol.getText(), 30, 30 );
help?
(or "\r\n\r\n")
g.drawString(textareaEng.g
help?
(or "\r\n\r\n")
ASKER
i tried \r\n and it didnt work but will try \n\r so please wait a minute till i update my code...
ASKER
nope it didnt work!
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
jeez never tried that!
havent got my java head on....
will be right back
havent got my java head on....
will be right back
Should work I think
ASKER
yes it worked!
thank you for the fast reply adn working answer!
500 points and grade A
cheers sean
thank you for the fast reply adn working answer!
500 points and grade A
cheers sean
:°))
ASKER
hope you stillunderstand by what i mean from above?!