This week's book giveaway is in the OO, Patterns, UML and Refactoring forum.
We're giving away four copies of Refactoring for Software Design Smells: Managing Technical Debt and have Girish Suryanarayana, Ganesh Samarthyam & Tushar Sharma on-line!
See this thread for details.
The moose likes Java in General and the fly likes Printing using JTextArea ? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


JavaRanch » Java Forums » Java » Java in General
Bookmark "Printing using JTextArea ?" Watch "Printing using JTextArea ?" New topic
Author

Printing 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
}
});
}
public static void disableDoubleBuffering(Component c) {
RepaintManager currentManager = RepaintManager.currentManager(c);
currentManager.setDoubleBufferingEnabled(false);
}
// Re-enables double buffering globally.
public static void enableDoubleBuffering(Component c) {
RepaintManager currentManager = RepaintManager.currentManager(c);
currentManager.setDoubleBufferingEnabled(true);
}
X'S : Can anyone pls teach me how to print in JTextArea ? its an Emergency, thanks.
 
I’ve looked at a lot of different solutions, and in my humble opinion Aspose is the way to go. Here’s the link: http://aspose.com
 
subject: Printing using JTextArea ?
 
It's not a secret anymore!