?? pencil.java
字號:
package Painter;/*軟件作者: 熊錫君,時守剛軟件版權歸作者所有,其他人可以對軟件進行修改,可以使用軟件代碼,(按類使用請保留作者信息)*/import java.awt.*;import main.MyCanvas;public class Pencil extends Shape { private PointsSet pointsSet; // 構造方法 public Pencil(Color ColorPen,Color ColorBrush,int LineWide, int x, int y) { super(ColorPen,ColorBrush,LineWide); pointsSet = new PointsSet(50); pointsSet.addPoint(x, y); } public Pencil(Color ColorPen,Color ColorBrush,int LineWide ) { // super(ColorPen,ColorBrush,LineWide,Delete); pointsSet = new PointsSet(50); } public void setPoints(int x, int y){ pointsSet.addPoint(x, y); } public boolean IsPoint(int x,int y,float j1) { return false; } public void draw(Graphics g, int m_DrawMode,Color bgColor) { Graphics2D g2d = (Graphics2D)g; g2d.setColor(super.m_ColorPen); g2d.setStroke(MyCanvas.STROKES[super.m_LineWide]); 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]; g2d.drawLine(x, y, x, y); } else { g2d.drawPolyline(points[0], points[1], s); } } }
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -