Programming Forums
User Name Password Register
 

RSS Feed
FORUM INDEX | TODAY'S POSTS | UNANSWERED THREADS | ADVANCED SEARCH

Reply
 
Thread Tools Display Modes
Old Oct 8th, 2006, 2:52 PM   #1
Xian_Fung
Newbie
 
Join Date: Jun 2006
Posts: 15
Rep Power: 0 Xian_Fung is an unknown quantity at this point
Printing using the Printer

The program I'm working on reads info from a MYSQL database and displays it onto a JTextArea. I need to print what is displayed, but in the API, it seems to profer printing from files. Writing to a file then printing from it is a little wierd, what can I do?

Last edited by Xian_Fung; Oct 8th, 2006 at 3:06 PM. Reason: Don't like the title
Xian_Fung is offline   Reply With Quote
Old Oct 8th, 2006, 7:24 PM   #2
andro
Professional Programmer
 
Join Date: Oct 2005
Location: California
Posts: 312
Rep Power: 3 andro is on a distinguished road
Send a message via AIM to andro
One way to go about it would be to create a class that extends JTextArea and implements Printable.

Then you could just add a print() method, that calls printJob.setPrintable(this) along the way.


In the 1.6 JDK, all classes that inherit from JTextComponent have support for printing by default, so you won't have to do this anymore.
andro is offline   Reply With Quote
Old Oct 10th, 2006, 6:28 PM   #3
Xian_Fung
Newbie
 
Join Date: Jun 2006
Posts: 15
Rep Power: 0 Xian_Fung is an unknown quantity at this point
Ah, thank you very much. I will try it out as soon as I fix a couple critical errors...
Xian_Fung is offline   Reply With Quote
Reply

Bookmarks

« Previous Thread in Forum | Next Thread in Forum »

Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Which Printer Do You Recommend ? on_auc Coder's Corner Lounge 2 Nov 20th, 2005 6:46 AM
Printer Problem Teecha Coder's Corner Lounge 15 Nov 3rd, 2005 3:24 PM
Printing From Printer Firebirdracer14 Visual Basic 2 Aug 4th, 2005 10:06 AM
Printer stream in C Daniel_kd C 2 Apr 7th, 2005 10:28 AM
Virtual Printer danparker Other Programming Languages 3 Jan 22nd, 2005 1:44 PM




DaniWeb IT Discussion Community
All times are GMT -5. The time now is 9:47 PM.

Powered by vBulletin® Version 3.7.0, Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Copyright ©2007 DaniWeb® LLC