|
-
September 3rd, 2002, 01:56 PM
#1
FileDialog
Hi,
I'm using FileDialog from AWT. How do I know when the open button is hit? Is there a listener that I should use?
Thanks,
Akee
-
September 3rd, 2002, 03:06 PM
#2
Re: FileDialog
Originally posted by akee
Hi,
I'm using FileDialog from AWT. How do I know when the open button is hit? Is there a listener that I should use?
Thanks,
Akee
The Open() or Show() ( Can't remember which ) will return once the open button has been hit.
Jared
-
September 3rd, 2002, 03:19 PM
#3
Re: FileDialog
Hi,
What I was trying to do was to take the filepath and put it in a text box on a different form than the FileDialog window when the user hits load in the FileDialog window. I don't know how to get the text or set up event listening for the load button. I'm kinda new at doing GUI's in Java.
Thanks,
Akee
-
September 5th, 2002, 12:22 AM
#4
Greetings.
Take a look at the API Specification and you'll find an answer.
First, call the show() method of the dialog. That blocks your app until the user has chosen a file and dismissed the dialog. Then, to get the chosen file, call one of those getDirectory() or getFile() methods. You can tell if the user has Cancelled the dialog by their returned values. If he has cancelled it, those methods return null, otherwise they return a String object.
Hope that helped,
Captain Nuss
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|