0% found this document useful (0 votes)
26 views1 page

AWT Program For FileDialog

The document contains a Java AWT program that creates a simple graphical user interface with two buttons: 'ok' and 'cancel'. When the 'ok' button is clicked, a FileDialog is displayed for saving a file. The program sets up the frame and makes it visible with specified dimensions.

Uploaded by

PRABHAKAR MORE
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
26 views1 page

AWT Program For FileDialog

The document contains a Java AWT program that creates a simple graphical user interface with two buttons: 'ok' and 'cancel'. When the 'ok' button is clicked, a FileDialog is displayed for saving a file. The program sets up the frame and makes it visible with specified dimensions.

Uploaded by

PRABHAKAR MORE
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 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