i'm trying to make GUI that allowed people to save there shifts in a calendar. i'm trying to build my calendar using import java.uti.Calendar. during trying to print the Month it bring me back the current month 10 instead of 11 , any suggestions?
package hours_report;
import hours_report.MyPanel.MyActionListener;
import java.util.Calendar;
import java.util.Date;
public class MyCalendar {
private Calendar MyCurrentTime;
private int currentMonth;
public MyCalendar()
{
this.MyCurrentTime = Calendar.getInstance();
}
public Date getDate()
{
return MyCurrentTime.getTime();
}
public int getMonth()
{
currentMonth = MyCurrentTime.get(MyCurrentTime.MONTH);
return currentMonth;
}
}
package hours_report;
import javax.swing.*;
public class Tester {
public static void main(String[] args)
{
JFrame frame = new JFrame("Hours Report MI QA");
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
frame.setSize(600,700);
MyPanel p = new MyPanel();
frame.add(p);
MyCalendar cal = new MyCalendar();
System.out.println(cal.getDate());
System.out.println(cal.getMonth());
frame.setVisible(true);
}
}