title: Drawing a line with arrow in Java
body: <p><img src="https://i.stack.imgur.com/Vakzu.gif" alt="alt text">Can anyone guide me how to code the arrow line in different direction. 
  wa and wl is positive the rectangle will be on top of the x-axis. Below example shown if wl is negative and wa is positive. The code below shown how i code the rectangle shape. x1 is the varaible to state where to start at x axis. e1 is the length of the shape, wa1 and wl1 is the height. wsign to determine the height wa1 or wl1 should display at negative side or positive side. </p>
  
  <pre><code>        if (Math.abs(wl1) &gt; Math.abs(wa1)) {
              y_scale = (load_y0 - 40) / (double) Math.abs(wl1);
          } else {
              y_scale = (load_y0 - 40) / (double) Math.abs(wa1);
          }
          g.drawLine((int) ((double) x0 + x1 * x_scale), (int) (load_y),
                      (int) ((double) x0 + x1 * x_scale),
                      (int) (load_y + (wa1 * y_scale) * -1));
              g.drawLine((int) ((double) x0 + (x1 + e1) * x_scale),
                      (int) (load_y), (int) ((double) x0 + (x1 + e1)
                              * x_scale), (int) (load_y + (wl1 * y_scale)
                              * -1));
  
              g.drawLine((int) ((double) x0 + x1 * x_scale),
                      (int) (load_y + (wa1 * y_scale * -1)),
                      (int) ((double) x0 + (x1 + e1) * x_scale),
                      (int) (load_y + (wl1 * y_scale) * -1)); 
  </code></pre>