📄 nestedrectscontroller.java
字号:
import objectdraw.*;import java.awt.*;// creates a set of NestedRects and allows them to be dragged or removed// according to the action of the mousepublic class NestedRectsController extends WindowController { // dimensions of NestedRects private static final double WIDTH = 200, HEIGHT = 100; private NestedRects rects; // draw a new set of NestedRects where the mouse was pressed public void onMousePress(Location point) { rects = new NestedRects( point.getX(), point.getY(), WIDTH, HEIGHT, canvas ); } // move the rects with the mouse public void onMouseDrag(Location point) { rects.moveTo(point.getX(), point.getY()); } // remove the rects from the canvas public void onMouseRelease(Location point) { rects.removeFromCanvas(); } }
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -