dimindicator.java

来自「一个数学算法的大集合」· Java 代码 · 共 42 行

JAVA
42
字号
import java.awt.*;class DimIndicator implements DrawingObj {    int x, y, left, right;    FloatingBox box;    public DimIndicator(int x, int y, int left, int right, 	String str, Font font) {	this.x = x;	this.y = y;	this.left = left;	this.right = right;	this.box = new FloatingBox(str, font);;	box.move(x - 32, y + 15);    }    public int getX() {	return x;    }    public int getY() {	return y;    }    public void move(int x, int y) {	this.left += x - this.x;	this.right += x - this.x;	this.x = x;	this.y = y;    }    public void draw(Graphics g) {	g.setColor(Color.black);	g.drawLine(left, y, left, y+2);	g.drawLine(right - 2, y, right - 2, y+2);	g.drawLine(left, y+2, right - 2, y+2);	g.drawLine(x, y + 2, x, y+15);	box.draw(g);    }}

⌨️ 快捷键说明

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