polyline.java
来自「windows画图板.类似于windows自带的画图程序!」· Java 代码 · 共 36 行
JAVA
36 行
import java.awt.*;
/**
*
* @author hysun
*/
public class PolyLine extends FreeShape {
private static int i;
public PolyLine(Color c, Stroke s, int x, int y) {
super(c, s, x, y);
}
public PolyLine() {
super();
}
public void draw(Graphics2D g) {
System.out.println(i);
i++;
g.setColor(color);
g.setStroke(stroke);
int[][] points = pointsSet.getPoints();
if (points == null)
return;
int s = points[0].length;
if (s == 1) {
int x = points[0][0];
int y = points[1][0];
g.drawLine(x, y, x, y);
} else {
g.drawPolyline(points[0], points[1], s);
}
}
}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?