drawnroundedrectangle.java

来自「使用java application 的共享白板系统」· Java 代码 · 共 22 行

JAVA
22
字号
import java.awt.*;
import java.io.Serializable;

public class DrawnRoundedRectangle extends DrawnShape implements Serializable{
    
        static final long serialVersionUID = -2082382400670851914L;
	public DrawnRoundedRectangle(Color color, int x, int y) {
		super(color, x, y, "draw rounded rectangle");
	}
	
	public void draw(Graphics g) {
		int width = x2 > x1 ? x2 - x1 : x1 - x2;
		int height = y2 > y1 ? y2 - y1 : y1 - y2;

		g.setColor(color);
		g.drawRoundRect(Math.min(x1, x2), Math.min(y1, y2), width, height, ARC_WIDTH, ARC_HEIGHT);
	}

	protected static final int ARC_WIDTH = 8;
	protected static final int ARC_HEIGHT = 8;
}

⌨️ 快捷键说明

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