?? triangle.java
字號:
///////////////////////////////////////////////////////////
// Name: Drawer //
// Author:Zhanghan //
// Date: 2005-9-10 //
// Email: zhang_han04@ncic.ac.cn //
///////////////////////////////////////////////////////////
import java.awt.*;
// The Triangle Class
public class Triangle extends Shape
{
private int xS[] = null;
private int yS[] = null;
public Triangle(Color color, Stroke stroke, int i, int j)
{
super(color, stroke, i, j);
xS = new int[3];
yS = new int[3];
}
public void draw(Graphics2D graphics2d)
{
xS[0] = currentX;
yS[0] = currentY;
xS[1] = currentX + currentD;
yS[1] = currentY;
xS[2] = currentX+ currentD / 2;
yS[2] = (int)(currentY - currentD / 2 * 1.732);
graphics2d.setStroke(stroke);
graphics2d.drawPolygon(xS, yS, 3);
}
}
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -