Results 1 to 3 of 3
- 09-05-2011, 12:58 AM #1
Help with using a jbutton actionlistener to open a text file
I've been building a contact editor GUI using Netbeans 7, and I'm stuck on how to open a text file with a button. I've searched around, but only found advice relating to jfilechooser. The text file contains all the entries submitted to the contact editor, and I don't need it to be opened within the GUI, just with notepad outside of the program.
Any help is appreciated!
- 09-05-2011, 01:34 AM #2
Re: Help with using a jbutton actionlistener to open a text filehow to open a text file with a button
with notepad outside of the program.
If you want to specify which program to use, see the Process and Runtime classes where you can specify the full ccommand line to be executed.
- 09-05-2011, 01:38 AM #3
Re: Help with using a jbutton actionlistener to open a text file
Why do you need to open the file in Notepad? Why can't you display the file on a JTextArea or a JEditorPane?
If you are determined to use Notepad then you can investigate Runtime.exec but make sure you google "pitfalls of runtime exec" or something similar.
- By coopc in forum New To JavaReplies: 3Last Post: 05-04-2011, 01:02 AM
- By Fortu in forum New To JavaReplies: 6Last Post: 02-05-2011, 05:20 PM
- By bitse in forum Java AppletsReplies: 0Last Post: 12-09-2010, 06:56 PM
- By globo in forum Advanced JavaReplies: 2Last Post: 11-21-2010, 08:39 PM
- By artemff in forum CLDC and MIDPReplies: 3Last Post: 12-23-2009, 07:39 PM