您需要从框架中删除上一个面板,如下所示:private void InitCal(Month month, int year) { if(calPanel!= null){ this.remove(calPanel); this.revalidate();}...最后,您需要在添加新月份面板后重新验证框架,如下所示:...this.add(calPanel);this.revalidate(); // You need to revalidate to component to see the changes.}