This week's book giveaway is in the Jython/Python forum.
We're giving away four copies of Murach's Python Programming and have Michael Urban and Joel Murach on-line!
See this thread for details.
Win a copy of Murach's Python Programming this week in the Jython/Python forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

a small GUI question  RSS feed

 
Paul Liullllllllllll
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

I have a button, and when I click it, I want to open a file (txt or html) in the local filesystem. In the ActionPerformed method, I don't know use which class to open this file and show the contents, can anyone give me a hint? thanks in advance.
 
Gregg Bolinger
Ranch Hand
Posts: 15304
6
Chrome IntelliJ IDE Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
JFileChooser
 
Paul Liullllllllllll
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
thanks. I know I can use JFileChooser to select a file, but how to display the contents of this file, I mean use notepad or IE to open a file.
 
Aaron Roberts
Ranch Hand
Posts: 174
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You could use a JTextArea for the text. Are you going to simply display the file or are they going to edit it?

Regards,
Aaron R>
 
Paul Liullllllllllll
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
thanks, just for display, I'll try what you suggested. But I am still wondering if there is any way to call native application to open a file.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!