title: AffineTransform
body: <p>Well i use this code to paint my Graph's Edges, 
  If the user wants to see the graph in its Flow mode then i draw arrows instead of lines,  all works perfectly, UNTILL I CHANGE WINDOW SIZE, then the arrows starting point (x1,y1) get moved unsynchronizely with my nodes leaving them unconnected, while drawLine() works perfect.</p>
  
  <p>is this something to do with the AffineTransform? </p>
  
  <p>(the arrows painting methodology is adopted from  <a href="https://stackoverflow.com/questions/3488419/java-draw-a-ruler-line-with-tick-marks-at-90-degree-angle/3488474#3488474">here</a>) )</p>
  
  <pre><code>    void drawArrow(Graphics g1, int x1, int y1, int x2, int y2) {
      Graphics2D g = (Graphics2D) g1.create();
      int arrowSize = 5;
      double dx = x2 - x1, dy = y2 - y1;
      double angle = Math.atan2(dy, dx);
      int len = (int) Math.sqrt(dx*dx + dy*dy);
      AffineTransform at = AffineTransform.getTranslateInstance(x1, y1);
      at.concatenate(AffineTransform.getRotateInstance(angle));
      g.setTransform(at);
      g.drawLine(0, 0, len, 0);
      g.setStroke(new BasicStroke(1));
      g.drawLine(len/3, arrowSize , len/3-3*arrowSize, 0);
      g.drawLine(len/3, -arrowSize , len/3-3*arrowSize, 0);
  }
  </code></pre>
  
  <p>to whoever wandered how the paint Edge method look like:</p>
  
  <pre><code>    public void paintEdge(Graphics g) {
      Point uCenter = u.getCenter();
      Point vCenter = v.getCenter();
      g.setColor(color);
      Graphics2D g2=(Graphics2D) g;
      g2.setStroke(new BasicStroke(3));
      if (mode==Mode.FLOW) {
          int minx=Math.min(uCenter.x, vCenter.x),miny=Math.min(uCenter.y, vCenter.y);
          int maxx=Math.max(uCenter.x, vCenter.x),maxy=Math.max(uCenter.y, vCenter.y);
          g2.drawString(""+ f + " / " + c,10+minx + (maxx-minx)/2,10+miny+ (maxy- miny)/2);
          drawArrow(g2,uCenter.x, uCenter.y, vCenter.x, vCenter.y);
      } else {
          g2.drawLine(uCenter.x, uCenter.y, vCenter.x, vCenter.y);
      }
      g2.setStroke(new BasicStroke(1));
  }
  </code></pre>