Java AWT FileDialog Open Save

Java AWT FileDialog Open Save

The FileDialog class provides a File Open or Save dialog box enabling us to access the local file system. The FileDialog class of Java is OS dependent and calls operating system's specific Open File dialog box or Save dialog box. The advantage of this is that the users of Java program will see familiar screens.

Following is the class signature

public class FileDialog extends Dialog

Example on FileDialog

In the following file dialog program, when the user clicks the button, the Open dialog box of the Windows OS is opened. The file selected by the user is read and opened in a text area. At the same time, the complete path of the selected file is displayed.

Java AWT FileDialog Open Save

Output screen of Java AWT FileDialog Open Save

5 thoughts on “Java AWT FileDialog Open Save

  1. asfaar

    how can i create a save as dialog box that can save a file with a given file name
    I request you sir to kindly write a program to create a save as dialog box
    please……….

Leave a Reply

Your email address will not be published. Required fields are marked *