Dialog Box: A dialog box holds related controls and is used to get input from user. It doesn’t have a menu bar. There are two types of Dialog box: modal and modeless. Modal dialog box locks the control of the program to the dialog box. Unless, the modal dialog box is closed a user cannot access to other programs. For a modeless dialog box, user can access other parts of program while it is still open.
Dialog class: It is used to create dialog box.
Constructors defined by Dialog class:
By using parent window and setting modal or modeless. If mode is true, dialog box is modal, otherwise modeless.
Dialog(Frame pwindow, boolean mode)
By using parent window, setting modal or modeless and title of dialog box.
Dialog(Frame pwindow, String title, boolean mode)
FileDialog class: It is used to create a file dialog box.
Constructors defined by FileDialog class:
By using a parent of dialog box.
By using parent, and title of dialog box.
FileDialog(Frame parent, String title)
By using parent, title of dialog box, and to set a dialog box for reading or writing a file. If rw is FileDialog.LOAD then dialog box selects a file for reading. If it is FileDialog.SAVE then dialog box selects a file for writing.
FileDialog(Frame parent, String title, int rw)
Methods defined by FileDialog class:
getDirectory( ) method: It is used to obtain the directory of the file.
String getDirectory( )
getFile( ) method: It is used to obtain the name of file.
String getFile( )