import javax.swing.*;
import java.awt.*;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
public class Front_ChristmasCard extends JFrame implements ActionListener
{
static String Guestname;
private boolean cardOpen=false;
private JButton cardOpenButton = new JButton("Open Card");
public Front_ChristmasCard()
{
Guestname= JOptionPane.showInputDialog("Enter your name to see your card:");
//sets title above window
setTitle("Marry Christmas " + Guestname);
// sets layouts, adds buttons and sets background.
setLayout(new FlowLayout());
add(cardOpenButton);
getContentPane().setBackground(Color.CYAN);
//adds listener
cardOpenButton.addActionListener(this);
//sets size of window
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
setSize(700,900);
setLocation(750,750);
setVisible(true);
}
public void paint(Graphics g)
{
g.drawString("Merry Christmas " + Guestname + "",300, 800);
g.setColor(Color.white);
g.fillRect(130,700,460,45);
g.setColor(Color.red);
g.fillRect(150,655,420,45);
g.fillRect(170,615,380,45);
g.fillRect(190,575,340,45);
g.fillRect(210,535,300,45);
g.fillRect(230,495,260,45);
g.fillRect(250,455,220,45);
g.fillRect(270,415,180,45);
g.fillRect(290,375,140,45);
g.fillRect(310,335,100,45);
g.fillRect(340,295,40,45);
g.setColor(Color.white);
g.fillOval(320,255,140,100);
}
public void actionPerformed(ActionEvent event)
{
if(event.getSource() == cardOpenButton)
{
cardOpen = true;
Inside_ChristmasCard gui= new Inside_ChristmasCard();
}
}
public static void main(String[] args)
{
Front_ChristmasCard gui=new Front_ChristmasCard();
}//main
}//class