Draws the arrow. @param panel the drawing panel in which the arrow is viewed @param g the graphics context upon which to draw
(DrawingPanel panel, Graphics g)
| 159 | * @param g the graphics context upon which to draw |
| 160 | */ |
| 161 | @Override |
| 162 | public void draw(DrawingPanel panel, Graphics g) { |
| 163 | Graphics2D g2 = (Graphics2D) g; |
| 164 | AffineTransform tr = panel.getPixelTransform(); |
| 165 | g2.setPaint(color); |
| 166 | // draw the shaft |
| 167 | g2.draw(tr.createTransformedShape(new Line2D.Double(x, y, x+a, y+b))); |
| 168 | ptA.setLocation(x+a, y+b); |
| 169 | tr.transform(ptA, ptA); |
| 170 | double aspect = panel.isSquareAspect() ? 1 : -tr.getScaleX()/tr.getScaleY(); |
| 171 | Shape temp = getHead(ptA, Math.atan2(b, aspect*a)); |
| 172 | // draw the head |
| 173 | g2.fill(temp); |
| 174 | g2.setPaint(Color.BLACK); |
| 175 | } |
| 176 | |
| 177 | private double lastTheta = java.lang.Double.NaN, lastX, lastY, lastHeadSize; |
| 178 | private Shape head; |
nothing calls this directly
no test coverage detected