/**
* @(#)HappyFathersDay.java
*
*
* @author -> Anant Mahale
* @version 1.00 2013/6/16
*/
import java.awt.*;
import java.awt.event.*;
class ButtonFrame extends Frame implements ActionListener
{
private Button btn_press;
public ButtonFrame()
{
setLayout(new FlowLayout());
setTitle("Wish");
setSize(500,500);
setLocation(200,200);
btn_press=new Button("Wish Your Father");
btn_press.setForeground(Color.orange);
btn_press.addActionListener(this);
add(btn_press);
addWindowListener(new WindowAdapter()
{
public void windowClosing(WindowEvent we)
{
System.exit(0);
}
});
}
public void actionPerformed(ActionEvent ae)
{
if(ae.getSource()==btn_press)
{
new dailog().setVisible(true);
}
}
}
class dailog extends Dialog implements ActionListener
{
private Button btn_yes;
private Panel north_panel,south_panel;
public dailog()
{
super(new ButtonFrame(),"Dialog Demo",true);
setBackground(Color.darkGray);
south_panel=new Panel();
setTitle("Father's Day Wishes");
setSize(700,250);
setLocation(50,80);
btn_yes=new Button("Exit");
south_panel.add(btn_yes);
add(south_panel,"South");
btn_yes.addActionListener(this);
}
public void paint(Graphics g)
{
g.setFont(new Font("MV Boli",Font.BOLD,30));
g.setColor(Color.RED);
g.drawString("Your guiding hand on my shoulder,",75,80);
g.drawString("Will remain with me forever.,",75,110);
g.drawString("Thanks for always being there Papa.",75,140);
g.drawString("Happy Father’s Day!",75,170);
}
public void actionPerformed(ActionEvent ae)
{
if(ae.getSource()==btn_yes)
{
System.exit(0);
}
}
}
class HappyFathersDay
{
public static void main(String args[])
{
new ButtonFrame().setVisible(true);
}
}
No comments:
Post a Comment