• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

How to print using JTextArea?

 
Jan Michael Soan
Ranch Hand
Posts: 36
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello;
I've have encountered a problem while trying to print a text within my JTextArea. Assuming that an action command fires each time a press the JButton named b1.
b1.addActionListener(new ActionListener() {

public void actionPerformed(ActionEvent e)
{
PrinterJob job = PrinterJob.getPrinterJob();
job.setPrintable(bb.getGraphics()); // Here is the Problem
if (pjob.printDialog())
{
try
{
pjob.print();
}
catch(PrinterException pe) {}
}// end if
}
});
}
X'S : Can anyone pls teach me how to print in JTextArea ? its an Emergency, thanks.
 
Avi Abrami
Ranch Hand
Posts: 1141
1
Java Oracle
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Jan Michael,
I'm not sure if this is relevant, but have you read this article:
http://www.fawcette.com/javapro/2002_12/online/print_kgauthier_12_10_02/
Hope it helps.
Good Luck,
Avi.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic