Win a copy of Functional Reactive Programming this week in the Other Languages forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

problem in printing to file (JSE 6)

 
Luca Adamo
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
I tried using printing support in JTextComponent, as provided in Java SE 6.

The code I used is really simple:


I actually took this from a tutorial (http://java.sun.com/docs/books/tutorial/uiswing/misc/printtext.html)

This works fine if I print to an actual printer (on paper :P ): a dialog is shown I can choose options etc. But if i choose the provided option of printing to file it doesn't work: i can choose the directory and the name for the file, it looks like everything is working fine but no file is created. No exception is thrown and the print method return true.
Anyone tried using this method to print?
Thanks
 
Maneesh Godbole
Saloon Keeper
Posts: 11196
15
Android Eclipse IDE Google Web Toolkit Java Mac Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Strange.
I tried out the example code, and I got an out.prn file successfully created on my desktop.
 
Luca Adamo
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks for you answer!
I think I'm supposed to get a ps file, since the default name is out.ps. Maybe that's beacause I'm working on a mac... What are you using?
 
Maneesh Godbole
Saloon Keeper
Posts: 11196
15
Android Eclipse IDE Google Web Toolkit Java Mac Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Possibly.
I am on WinXP
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic