You are on page 1of 1

// AWT Program for FileDialog

import java.awt.*;
import java.awt.event.*;

public class Myclass extends Frame implements ActionListener


{
Button b,b2;

Myclass()
{
setLayout(new FlowLayout());
b=new Button("ok");
b2=new Button("cancel");

add(b);
b.addActionListener(this);
b2.addActionListener(this);
}

public void actionPerformed(ActionEvent e)


{
if(e.getSource()==b)
{
FileDialog d=new FileDialog(new Myclass(),"Mydialog",FileDialog.SAVE);

d.setVisible(true);
}

public static void main(String args[])


{
Myclass m=new Myclass();
m.setSize(500,500);
m.setVisible(true);

You might also like