How to draw a rectangle on a java applet using mouse drag event and make it stay

前端 未结 4 456
梦毁少年i
梦毁少年i 2021-01-01 06:40

I have my program that can draw rectangles. I have two problems I can\'t solve. After I draw the rectangle it won\'t stay. The only code I have that clears the canvas in und

4条回答
  •  萌比男神i
    2021-01-01 07:03

    Read up on these two Custom Painting Approaches. One approach is described above and the second approach shows how to use a BufferedImage. The example used for both approaches allows you to add multiple Rectangles to the frame.

提交回复
热议问题