不要自己调用paintComponent方法,只要你的程序需要重新绘制(比如窗口缩放、被覆盖再重新显示),那个方法会自动调用。如果要强制重绘,可以调用repaint()方法代替paintComponent()。