public void paintComponent (Graphics g)
	{
		super.paintComponent(g);
		g.setColor(Color.BLACK);
 		 x1 = (int)(CONSTANT_A*X_DIM);//determining the location to draw the outline of the calendar
		 y1 = (int)(CONSTANT_B*Y_DIM);
		 boxWidth = (int)(CONSTANT_C*X_DIM);//determining the dimensions of the box
		int boxHeight = (int)(CONSTANT_D*Y_DIM);
		
	    g.setFont(TITLE_FONT);
	    int extra = (currentMonth.getName()).length()-5;//calculate number of letters more than "March"
	    int constant = (int) (boxWidth/10.0);
	    int x_value = x1+(constant*4);
	    g.drawString(currentMonth.getName()+", "+currentYear.getNumber(), x_value-(5*extra),(int)(y1/1.5));//attempt to centre

	    
		g.drawImage(forwardArrow,boxWidth+x1-40,(int)(y1/3.0),null);//x values: 30-70, y values: 15-45
		g.drawImage(backwardArrow,x1,(int)(y1/3.0),null);//x values: 774-814
		
		g.drawRect(x1,y1,boxWidth, boxHeight);//line for date
				
		double h = 75.0/600;
		int y2 = (int)(h*Y_DIM);//position of the line
		g.drawLine(x1, y2,x1+boxWidth, y2);
	
		each_x = (int) (boxWidth/7.0);
		each_y = (int)((boxHeight-(y2-y1))/6.0);

		int var = x1;
		g.setFont(BOLD_FONT);
		g.drawString("Sunday",centre(var, var+=each_x,"Sunday"),(int)(y1*1.25));
		g.drawString("Monday",centre(var, var+=each_x,"Monday"),(int)(y1*1.25));
		g.drawString("Tuesday",centre(var, var+=each_x, "Tuesday"),(int)(y1*1.25));
		g.drawString("Wednesday",centre(var, var+=each_x, "Wednesday"),(int)(y1*1.25));
		g.drawString("Thursday",centre(var, var+=each_x, "Thursday"),(int)(y1*1.25));
		g.drawString("Friday",centre(var, var+=each_x, "Friday"),(int)(y1*1.25));
		g.drawString("Saturday",centre(var, var+=each_x, "Saturday"),(int)(y1*1.25));
		
		int variable_x = x1;
		int variable_y = y2;
		
		
		 for (int j = 0;j<6;j++)//nested loop to add boxes, loop to go through weeks in a month
	        {
			 variable_x = x1;
	        	for (int i = 0;i<7;i++)//loop to go through days in a week
	        	{
	        		int boxNumber = (j*7)+(i+1);//square number is the index number in the arraylist plus 1
	        		Box tempBox = boxes.get(boxNumber-1);
	        		tempBox.setTopLeft(variable_x, variable_y);
	        		variable_x+=each_x;
	        		tempBox.setOthers(each_x, each_y);
	        	}
	        	variable_y+=each_y;
	        }
		
		 g.setFont(NORMAL_FONT);
		 
		 int num = currentMonth.getFirstDay();
		 if (num ==0)
			 num=7;
		 
		 for (int i = 1;i<=currentMonth.getDaysInMonth();i++)
		 {
			 Box tempBox = boxes.get(i+num-1);
			 Day currentDay = currentMonth.getDays().get(i-1);
			 tempBox.setDayStored(currentDay);
			 tempBox.setMonthStored(currentMonth);
			 tempBox.setYearStored(currentYear);
			 int [] topLeft = tempBox.getTopLeft();
			 g=drawBox(tempBox,g,false);
			 g.drawString (currentDay.getNum()+"",topLeft[0]+10, topLeft[1]+20);
			 boxes.set(i+num-1, tempBox);
		 }
		 
		 Month previousMonth = currentYear.getMonths().get((CalendarFunctions.previousMonth(currentMonth.getNum())-1));
		 int k = previousMonth.getDaysInMonth()-num;
		 
		 for (int i = 0;i<num;i++)
		 {
			 Box tempBox = boxes.get(i);
			 Day currentDay = previousMonth.getDays().get(k);
			 k++;
			 tempBox.setDayStored(currentDay);
			 tempBox.setMonthStored(previousMonth);
			 tempBox.setYearStored(currentYear);
			 int [] topLeft = tempBox.getTopLeft();
			 g=drawBox(tempBox,g, false);
			 g.setColor(light);
			 g.drawString(currentDay.getNum()+"", topLeft[0]+10, topLeft[1]+20);
			 boxes.set(i, tempBox);
		 }
		
		 
		 Month nextMonth = currentYear.getMonths().get((CalendarFunctions.nextMonth(currentMonth.getNum())-1));
		 int r = 1;
		 for (int i = currentMonth.getDaysInMonth()+num;i<boxes.size();i++)
		 {
			 Box tempBox = boxes.get(i);
			 Day currentDay = nextMonth.getDays().get(r-1);
			 r++;
			 tempBox.setDayStored(currentDay);
			 tempBox.setMonthStored(nextMonth);
			 tempBox.setYearStored(currentYear);

			 int [] topLeft = tempBox.getTopLeft();
			 g=drawBox(tempBox,g,false);
			 g.setColor(light);
			 g.drawString(currentDay.getNum()+"", topLeft[0]+10, topLeft[1]+20);
			 boxes.set(i, tempBox);					 
		 }
		 
	
		 for (int i = 0;i<boxes.size();i++)
		 {
			 Box tempBox = boxes.get(i);
			 Day tempDay = tempBox.getDayStored();
			 Day cursorDay = cursor.getDayStored();
			 Month cursorMonth = cursor.getMonthStored();
			 Month boxMonth = tempBox.getMonthStored();
			 if (cursorDay.getNum()==tempDay.getNum()&&cursorMonth.getName().equals(boxMonth.getName()) )
				 g=drawBox(tempBox,g,true);
		 }
	
		 g.setColor(Color.black);
		 
	
		//for (int x = x1+each_x;x<x1+boxWidth;x+=each_x)
			//if (x1+boxWidth-x>(int)(0.9*each_x))
				//g.drawLine(x,y1, x,boxHeight+y1);
		
		//for (int y = y2;y<=y1+boxHeight;y+=each_y)
			//if (y1+boxHeight-y>(int)(0.9*each_y))//if the box created is greater than atleast 90% of the normal size 
				//g.drawLine(x1, y, x1+boxWidth, y);
	
		
		//System.out.println(x*X_DIM);
		//System.out.println(y*Y_DIM);
		//g.drawRect(20,60,900,600);//draw the outline of the calender 
		
	}