0% found this document useful (0 votes)
10 views5 pages

# Dialog Box

Uploaded by

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

# Dialog Box

Uploaded by

ayushdesai151
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 5

# dialog box

import java.awt.*;
class demodi extends Dialog
{
demodi(Frame fr)
{
super(fr,false); //true=no contol to other programs
//false=contol to other programs
setSize(200,200);
setVisible(true);
}
}
public class demodilog
{
public static void main(String[] args)
{
Frame fr=new Frame();
demodi ob=new demodi(fr);
TextField t=new TextField(30);
fr.setLayout(new FlowLayout());
fr.add(t);
fr.setSize(500,500);
fr.setVisible(true);

}
}

#dialog box with button


import java.awt.*;
class demodi extends Dialog
{
Button b1,b2;
demodi(Frame fr)
{
super(fr,false); //true=no contol to other programs
//false=contol to other programs
setLayout(new FlowLayout());
setTitle("click cancel to exit::");
b1=new Button("ok");
b2=new Button("cancel");
add(b1);
add(b2);

setSize(200,200);
setVisible(true);
}
}
public class demodilog
{
public static void main(String[] args)
{
Frame fr=new Frame();
demodi ob=new demodi(fr);
TextField t=new TextField(30);
fr.setLayout(new FlowLayout());
fr.add(t);
fr.setSize(500,500);
fr.setVisible(true);

}
}
#File Dialog
import java.awt.*;
public class demofiledialog
{
public static void main(String[] args)
{
Frame fr=new Frame();
FileDialog fd=new FileDialog(fr,"Open File");
fd.setVisible(true);
fr.setSize(400,400);
fr.setVisible(true);
}
}

You might also like