Skip to Main Content

Java SE (Java Platform, Standard Edition)

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

How to react on events fired by a JFileChooser?

843804Mar 29 2005 — edited Mar 31 2005
Hello again.

I hava a FileChooser in my application to load an XML-file and then show its contents in a tab of a JTabbedPane.
When the user chooses a file and then clicks on the open-button of the dialog, I want to check if the file exists. In case of a non-existing file I want to show a modal MessageDialog with a corresponding message. During this time the file dialog must not close and stay open until the user cancels the operation or chooses an existing file.

What do I have to do to achieve this? I think I have to add an actionlistener and override the actionPerformed-method of the open-button. But how? Can you perhaps give me a little code example?
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Apr 28 2005
Added on Mar 29 2005
4 comments
546 views