/** * A method to update the current month. Sets the variable that controls the month and updates the * text. * * @param newMonth an integer value between 0 and 11. */ public void updateMonth(int newMonth) { pastMonthOffset = currentMonthOffset; currentMonthOffset = CakeCal.getDayOfWeek(new SimpleDate((newMonth), 1, currentYear)); miniDays[(currentDay - 1) + pastMonthOffset].setForeground(Color.black); currentMonth = newMonth; miniCalTitle.setText(curMonths[currentMonth - 1] + ", " + currentYear); events = calendar.getEvents( Period.parse( currentYear + "." + currentMonth + ".1:00.00-" + currentYear + "." + currentMonth + "." + curMonths[currentMonth - 1] + ":24.00")); panelEvent.update(); if (currentDay > (CakeCal.getMonths(currentYear))[currentMonth - 1]) { currentDay = (CakeCal.getMonths(currentYear))[currentMonth - 1]; } updateDays(); mview.updateMonth(); dayView.updateDay(); weekView.updateWeek(); this.updateDays(); }
/** Updates the current events */ public void updateCurrentEvents() { events = calendar.getEvents( Period.parse( currentYear + "." + currentMonth + ".1:00.00-" + currentYear + "." + currentMonth + "." + curMonths[currentMonth - 1] + ":24.00")); }
/** * Get the events for a specific period. * * @param p The period to get events for * @return The events for the specific period */ public List<Event> getEvents(Period p) { return calendar.getEvents(p); }