marshape.java

来自「用java实现接口,实现不同图形的移动效果,主要是演示接口的用法」· Java 代码 · 共 29 行

JAVA
29
字号
import java.awt.*;

/**
 * Created by IntelliJ IDEA.
 * User: Administrator
 * Date: 2006-11-21
 * Time: 20:37:08
 * To change this template use File | Settings | File Templates.
 */
public class MarShape implements MoveableShape {
    private int x, y;
    private int size;

    public MarShape(int x, int y, int size) {
        this.x = x;
        this.y = y;
        this.size = size;
    }

    public void draw(Graphics g) {
        g.drawOval(x, y, size - 1, size - 1);
    }

    public void move(int x, int y) {
        this.x += x;
        this.y += y;
    }
}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?