class Months { //properties float x; float xm; float xa; color Colour; boolean drawLine; int LineHeight = (height - graphHeight) + 12; int TextHeight = LineHeight - 25; String[]monthNames = { "January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December" }; //stored month names //constructors Months(){ } //methods void update(float x, float xa, float xm, color Colour, boolean drawLine) { this.x = x; this.xm = xm; this.xa = xa; this.Colour = Colour; this.drawLine = drawLine; int count = 0; float num = (xm - woffset) / graphN; //total number of months up to where the mouse is if(num >= 12){ do { num = num - 12; count++; } while ( num >= 12); } //end if int numN = int(num); if(numN < 0){ numN = 0; } int theYear = startyear + count; if(drawLine){ line(xm, LineHeight, xa, TextHeight+4); line(xm, LineHeight, xm, height); } else { stroke(150, 100); line(xm, LineHeight, xm, height); fill(0); noStroke(); triangle(mouseX-5, LineHeight, mouseX+5, LineHeight, mouseX, LineHeight+6); triangle(mouseX-5, height, mouseX+5, height, mouseX, height-6); x = mouseX-45; } fill(255, 100); stroke(0, 80); rect(x, TextHeight-6, 90, 14); fill(Colour); textAlign(LEFT, CENTER); //set the font size to a proportion of the count textFont(font, 11); //display the text text(monthNames[numN] +" "+ theYear, x+10, TextHeight); } //end Months //methods }