![]() |
|
![]() |
|
|
Thread Tools | Display Modes |
|
|
#1 |
|
Newbie
Join Date: Jun 2006
Posts: 15
Rep Power: 0
![]() |
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 |
|
|
|
|
|
#2 |
|
Professional Programmer
|
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. |
|
|
|
|
|
#3 |
|
Newbie
Join Date: Jun 2006
Posts: 15
Rep Power: 0
![]() |
Ah, thank you very much. I will try it out as soon as I fix a couple critical errors...
|
|
|
|
![]() |
| Bookmarks |
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | |
| Display Modes | |
|
|
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 |