Win a copy of Kotlin in Action this week in the Kotlin forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

PrintJob and PrintDialog  RSS feed

 
Win Harrington
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Does anyone have a code sample showing PrintDialog
and PrintJob? I want to print the contents of
a TextArea.
Thanks
 
Win Harrington
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
OK, I'll answer my own question.

I was trying to print the html text in
my JEditorPane. This works.
private JEditorPane helpPane;
public void print()
{
PrintJob pjob = getToolkit().getPrintJob(new Frame(),
"Printer", null);
if (pjob != null)
{
Graphics pg = pjob.getGraphics();
if (pg != null){
helpPane.printAll(pg);
pg.dispose(); // flush page
}
pjob.end();
}
}
 
Anonymous
Ranch Hand
Posts: 18944
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello,
I want to try using the Printing API ,can you suggest where do I get some good reading Material with some examples.
regards,
suchitra
 
deekasha gunwant
Ranch Hand
Posts: 396
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi suchitra,
the best thing is u visit the sun's tutorial at their site. developer.java.sun.com
just go to tutorials->writing advanced applications
& u'll find tutorials on printing
regards
deekasha
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!