Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Printing Plain Text

Status
Not open for further replies.

egobbitz

Programmer
Oct 18, 2002
47
US
I am fairly new to java, but I am trying to write a text editor program (mostly for my own experience). I have most of the functionality of a basic editor, but would like to do some printing from it. I am using swing, with my main components being an extension of JFrame, and a JTextArea contained therein.
Can anyone give me some pointers on how to go about coding the print menu option? I have skimmed some of the tutorials on printing, but it all seems to be geared to shapes, etc. I just want to take what is in the text area and print it out to the printer.

Any pointers would be greatly appreciated.

Nick
 
Hmm, you could try a very basic operation and see if this will work if you wish to sidestep the printing API. However, I haven't tested this so no idea if it'll work.

FileOutputStream x = new FileOutputStream("lpt");
x.write(/*Whatever info here*/);
 
Hope this thread gets some answers. Its all I want to do as well, just print some text from a file.

Any help would be grateful.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top