import java.awt.*;
import java.awt.event.*;
public class FileDialogExample implements ActionListener{
Frame f;
Button b;
TextArea ta;
FileDialog fd;
static public void main(String args[]){
f=new Frame("FileDialog");
b=new Button("Show FileDialog");
b.addActionListener(this);
f.add("South",b);
ta=new TextArea();
f.add("Center",ta);
fd-new FileDialog(f,"FileDialog");
f.setSize(350,150) ;
f.setVisible(true);
}
public void actionPerformed(ActionEvent e){
fd.setVisble(true);
ta.setText("Directory: "+fd.getDirectory());
ta.append("/nFilename: "+fd.getFile());
}
}