Java Swing JPanel goes behind other panel instead of replacing it

You need to delete previous panel from frame like following:

private void InitCal(Month month, int year) {
  if(calPanel!= null){
    this.remove(calPanel);
    this.revalidate();
}
...

And at last you need to revalidate the frame after you add your new month panel like following:

...
this.add(calPanel);
this.revalidate(); // You need to revalidate to component to see the changes.
}