Introduction - If you have any usage issues, please Google them yourself
Programming ideas: first, to make this exercise because the instance box not catch, so first of all to make the interface box, first set the box through the Graphics class object function g.setColor (Color.red) color is red, then By statement g.drawRect (0, 0, size () width-. 1, size () height-. 1) and g.drawRect (mx, my, (size () .width/10)- 1, (size ( ) .height/10)- 1) draw two rectangles, thus completing the box production. Then, in order to achieve " catch box" effect, so to respond to mouse events, through the function public boolean mouseDown (java.awt.Event evt, int x, int y in response to pressing the mouse moves the cursor position to judge by Avoid mouse caught in the interface box.