Java Technology Home Page
A-Z Index

Java Developer Connection(SM)
Online Training

Downloads, APIs, Documentation
Java Developer Connection
Tutorials, Tech Articles, Training
Online Support
Community Discussion
News & Events from Everywhere
Products from Everywhere
How Java Technology is Used Worldwide
Print Button
 
Training Index

Display a File from FileDialog


by jGuru

Help  API Docs  About This Short Course  Short Course  Exercises

Create an application that instantiates and shows a FileDialog. Use getFile() to obtain the selected filename and display it as a label.

Skeleton Code

Tasks


  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.

Where help exists, the task numbers above are linked to the step-by-step help page.

Solution Source

Demonstration

This program cannot be run as an applet because opening a FileDialog is a security violation. Please run the solution DisplayFileDialog from the command line as an application.

Next Exercise

Exercises

Short Course

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


Print Button
[ This page was updated: 14-Jul-2000 ]
Products & APIs | Developer Connection | Docs & Training | Online Support
Community Discussion | Industry News | Solutions Marketplace | Case Studies
Glossary - Applets - Tutorial - Employment - Business & Licensing - Java Store - Java in the Real World
FAQ | Feedback | Map | A-Z Index
For more information on Java technology
and other software from Sun Microsystems, call:
(800) 786-7638
Outside the U.S. and Canada, dial your country's AT&T Direct Access Number first.
Sun Microsystems, Inc.
Copyright © 1995-2000 Sun Microsystems, Inc.
All Rights Reserved. Terms of Use. Privacy Policy.