List of utility methods to do Draw Arrow
void | drawArrow(Graphics2D g2d, int xCenter, int yCenter, int x, int y, float stroke) It defines functionality to draw arrows, by using colors and coordinates. double aDir = Math.atan2(xCenter - x, yCenter - y); g2d.drawLine(x, y, xCenter, yCenter); g2d.setStroke(new BasicStroke(1f)); Polygon tmpPoly = new Polygon(); int i1 = 12 + (int) (stroke * 2); int i2 = 6 + (int) stroke; tmpPoly.addPoint(x, y); tmpPoly.addPoint(x + xCor(i1, aDir + .3), y + yCor(i1, aDir + .3)); ... |
void | drawArrowHead(final Graphics2D aG, final int aXpos, final int aYpos, final int aFactor, final int aArrowWidth, final int aArrowHeight) Draws a single arrow head final double halfHeight = aArrowHeight / 2.0; final int x1 = aXpos + (aFactor * aArrowWidth); final int y1 = (int) Math.ceil(aYpos - halfHeight); final int y2 = (int) Math.floor(aYpos + halfHeight); final Polygon arrowHead = new Polygon(); arrowHead.addPoint(aXpos, aYpos); arrowHead.addPoint(x1, y1); arrowHead.addPoint(x1, y2); ... |
void | drawArrowHead(Graphics g, double c1, double c2, double phi, int l, int grad, boolean fill) draw Arrow Head phi = (phi + 180) % 360; int px = (int) (c1 + Math.cos((2 * Math.PI * (phi + grad) / 360)) * l); int py = (int) (c2 - Math.sin((2 * Math.PI * (phi + grad) / 360)) * l); int px2 = (int) (c1 + Math.cos((2 * Math.PI * (phi - grad) / 360)) * l); int py2 = (int) (c2 - Math.sin((2 * Math.PI * (phi - grad) / 360)) * l); if (fill) { g.fillPolygon(new int[] { (int) c1, px, px2 }, new int[] { (int) c2, py, py2 }, 3); } else { ... |
void | drawArrowLine(Graphics g, int x1, int y1, int x2, int y2, int d, int h, boolean capOnly) draw Arrow Line int dx = x2 - x1, dy = y2 - y1; double D = Math.sqrt(dx * dx + dy * dy); double xm = D - d, xn = xm, ym = h, yn = -h, x; double sin = dy / D, cos = dx / D; x = xm * cos - ym * sin + x1; ym = xm * sin + ym * cos + y1; xm = x; x = xn * cos - yn * sin + x1; ... |
void | drawArrowLine(Graphics g, int x1, int y1, int x2, int y2, int dist, boolean arrowLeft, boolean arrowRight) draw Arrow Line int off = 3; g.drawLine(x1 + off + 1, y1, x2 - off - 1, y2); if (arrowLeft) { g.drawLine(x1, y1, x1 + dist, y1 - off); g.drawLine(x1, y1, x1 + dist, y1 + off); g.drawLine(x1 + dist, y1 - off, x1 + dist, y1 + off); if (arrowRight) { ... |
void | drawDoubleHeadedArrow(final Graphics aG, final int aX1, final int aY, final int aX2) Draws a double headed arrow of 8x8. drawDoubleHeadedArrow(aG, aX1, aY, aX2, aY); |
void | drawHorizontalArrow(Graphics g, Rectangle r, boolean direction) draw Horizontal Arrow int[] x; int[] y; int dy = r.height / 3; int y0 = r.y; int y1 = y0 + dy; int y3 = y0 + r.height; int y2 = y3 - dy; int yc = (y1 + y2) / 2; ... |