File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Java in General and the fly likes How to print using JTextArea? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of JavaScript Promises Essentials this week in the JavaScript forum!
JavaRanch » Java Forums » Java » Java in General
Bookmark "How to print using JTextArea?" Watch "How to print using JTextArea?" New topic
Author

How to print using JTextArea?

Jan Michael Soan
Ranch Hand

Joined: Feb 08, 2003
Posts: 36
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

Joined: Oct 11, 2000
Posts: 1135

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.
 
 
subject: How to print using JTextArea?