nestedrectscontroller.java~

来自「书籍"Java_面向事件编程"的附带光盘代码」· JAVA~ 代码 · 共 29 行

JAVA~
29
字号
import objectdraw.*;import java.awt.*;// demonstrates the use of public class NestedRectsController extends WindowController {    // dimensions of NestedRects    private static final double WIDTH = 200,                                HEIGHT = 100;    private NestedRectsIfc rects;    // draw a new set of NestedRects on the canvas    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 + =
减小字号Ctrl + -
显示快捷键?