Sun Java Solaris Communities My SDN Account Join SDN
 
Tutorials & Code Camps

Help

 

Training Index

by jGuru

Exercise  API Docs  About This Short Course  Short Course  Exercises

Help is available for each task.

Task 1

Create a Frame to use as a parent and then create a FileDialog attached to that frame with a title of "Open". Show the file dialog. The current thread will block (unlike a pure Dialog object). Print to standard output the filename you typed in or selected--handle a null value gracefully. Do not forget to dispose of the frame you created.

While selecting a file from the list works, unfortunately, typing in a file name that does not exist does not work. The file dialog leaves the ".*.*" on the end of your filename. Try typing in "foo" and the file dialog will give you an error. Be aware of this idiosyncrasy. With some platforms, FileDialog reports that the file does not exist before you can see it in Java and requires the user to enter another name or to select 'Cancel'.

Copyright 1996-2000 jGuru.com. All Rights Reserved.