oval.java
来自「windows画图板.类似于windows自带的画图程序!」· Java 代码 · 共 39 行
JAVA
39 行
import java.awt.*;
/**
*
* @author hysun
*/
public class Oval extends RectBoundedShape {
public Oval(Color c, Stroke s, int x, int y) {
super(c, s, x, y);
}
public Oval() {
super();
}
public void draw(Graphics2D g) {
g.setColor(color);
g.setStroke(stroke);
int x, y, w, h;
if (startX > endX) {
x = endX;
w = startX - endX;
} else {
x = startX;
w = endX - startX;
}
if (startY > endY) {
y = endY;
h = startY - endY;
} else {
y = startY;
h = endY - startY;
}
g.drawOval(x, y, w, h);
}
}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?