/*This class is responsible for creating all the components of the calendar*/

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

public class CalendarFrame extends Frame implements ActionListener {
  
  public CalendarFrame(String userid,ClientSocket cs)
  {
    clientsocket = cs;
    username = userid;
    MenuBar mb = new MenuBar();
    Menu fileMenu = new Menu("File");
    MenuItem openItem = new MenuItem("Open");
    openItem.addActionListener(this);
    fileMenu.add(openItem);
    fileMenu.addSeparator();
    MenuItem closeItem = new MenuItem("Close");
    closeItem.addActionListener(this);
    fileMenu.add(closeItem);
    mb.add(fileMenu);
  //   setMenuBar(mb); 

    setSize(610,700);
    setLayout(null);

   
    
    Label weekLabel = new Label();
    add(weekLabel);
    weekLabel.setBounds(117,68,60,10);

  
    //Weekly view
    WeekPanel wkpanel = new WeekPanel( clientsocket,weekLabel,username );    
    add(wkpanel);
    wkpanel.setBounds(5,110,320,550);    

    WeekButtonPanel weekbuttonpanel = new WeekButtonPanel(wkpanel);
    add(weekbuttonpanel); 
    weekbuttonpanel.setBounds(5,80,300,30);

    
    

    Label monthLabel = new Label();
    add(monthLabel);
    monthLabel.setBounds(442,68,60,10);
    //monthly view
    CalendarBox cal = new CalendarBox(monthLabel);
    add(cal);
    cal.setBounds(350,130,250,200);


    MonthButtonPanel monthbuttonpanel = new MonthButtonPanel(cal);
    add(monthbuttonpanel);
    monthbuttonpanel.setBounds(350,80,250,30);

    DaysOfWeek days = new DaysOfWeek();
    add(days);
    days.setBounds(350,100,250,50);

    //notification box
    MailboxPanel mailbox = new MailboxPanel(clientsocket);
    add(mailbox);
    mailbox.setBounds(350,370,250,50);
    //time
    TimePanel time = new TimePanel();
    add(time);
    time.setBounds(350,480,250,100);
    
    Button cancelbutton = new Button("Cancel");
    add(cancelbutton);
    cancelbutton.setBounds( 420 ,640,60,20);
    cancelbutton.addActionListener(this);

  }
  


  public void actionPerformed(ActionEvent evt)
  {

    dispose();

  }
  //deprecated
  public void paint(Graphics g)
  {
   //  g.drawString("Calendar",75,100); 
  }

  
  private ClientSocket clientsocket;
  private String username;


 //  public static void main( String[]args)
//     {
//       FirstFrame f = new FirstFrame();
//       f.show();
//     }
}









