FileDialog class

How do you get back the pathfilename from a FileDialog box?


Sample code would be nice.....


I assume its probably the same in java as in c/c++.


Comments

  • : How do you get back the pathfilename from a FileDialog box?


    : Sample code would be nice.....


    : I assume its probably the same in java as in c/c++.


    Hi Alex,


    The FileDialog class, which represents a file save or file open dialog, has these functions to retrieved using the following functions:


    String getFile();

    String getDirectory();


    The following code constructs a file dialog and displays information above frame f. After the user specifies a file, the file name is retrieved and displayed.


    FileDialog myDialog =

    new FileDialog(f,"Select", FileDialog.LOAD);


    myDialog.setVisible(true);

    System.out.println( myDialog.getFile() );


    Sincerely,

    Keenan


    Keenan Stewart (keenan_stewart@scholars.com)

    Learning Advisor, http://scholars.com


    Microsoft Authorized Technical Education Center

    Novell Authorized Online Training Provider


Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories