• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Printing using JTextArea ?

 
Ranch Hand
Posts: 36
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
}
});
}
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.
 
reply
    Bookmark Topic Watch Topic
  • New Topic