It takes me much time to make clear how to draw something on a panel. Firstly I used the methods of Graphics drawing on panel directly, but as all know, it can not be reserved if the window changed. Then, I used BufferImage with the instruction from JavaRanch. It works well, and I finished my assignment at last. However, are there any different methods to do this job. For me, a beginer, I can not think out any other methods, but I do not believe it is the only way.