Java Utililty Methods Graphics Draw Arrow

List of utility methods to do Graphics Draw Arrow

Description

The list of methods to do Graphics Draw Arrow are organized into topic(s).

Method

voidpaintArrow(Graphics g, Color color, int startX, int startY, int width, int orientation)
paint Arrow
Color oldColor = g.getColor();
g.setColor(color);
width = width / 2 * 2 + 1;
if (orientation == 0) {
    for (int i = 0; i < (width + 1) / 2; i++) {
        g.drawLine(startX + i, startY + i, startX + width - i - 1, startY + i);
else if (orientation == 1) {
    for (int i = 0; i < (width + 1) / 2; i++) {
        g.drawLine(startX + i, startY + i, startX + i, startY + width - i - 1);
g.setColor(oldColor);
voidpaintArrow(Graphics g, int x0, int y0, int x1, int y1)
paint Arrow
int deltaX = x1 - x0;
int deltaY = y1 - y0;
double frac = 0.2;
g.drawLine(x0, y0, x1, y1);
g.drawLine(x0 + (int) ((1 - frac) * deltaX + frac * deltaY),
        y0 + (int) ((1 - frac) * deltaY - frac * deltaX), x1, y1);
g.drawLine(x0 + (int) ((1 - frac) * deltaX - frac * deltaY),
        y0 + (int) ((1 - frac) * deltaY + frac * deltaX), x1, y1);
...