public void paint(Graphics g){
  if (m_from == null || m_to == null)   return;
  Polygon arrow=new Polygon();
  Point from=null;
  Point to=null;
  if (isRightTop()) {
    from=addPoint(arrow,m_from,SwingConstants.RIGHT,true);
    to=addPoint(arrow,m_to,SwingConstants.TOP,false);
  }
 else   if (isBottomTop()) {
    from=addPoint(arrow,m_from,SwingConstants.BOTTOM,true);
    to=addPoint(arrow,m_to,SwingConstants.TOP,false);
  }
 else   if (isTopBottom()) {
    from=addPoint(arrow,m_from,SwingConstants.TOP,true);
    to=addPoint(arrow,m_to,SwingConstants.BOTTOM,false);
  }
 else   if (isLeftRight()) {
    from=addPoint(arrow,m_from,SwingConstants.LEFT,true);
    to=addPoint(arrow,m_to,SwingConstants.RIGHT,false);
  }
 else {
    from=addPoint(arrow,m_from,SwingConstants.RIGHT,true);
    to=addPoint(arrow,m_to,SwingConstants.LEFT,false);
  }
  if (!m_next.isUnconditional()) {
    g.setColor(Color.red);
    g.fillPolygon(arrow);
  }
  if (m_visited)   g.setColor(Color.green);
 else   g.setColor(Color.black);
  g.drawPolygon(arrow);
  if (m_next.isFromSplitAnd()) {
    g.setColor(Color.magenta);
    g.fillOval(from.x - 3,from.y - 3,6,6);
  }
  if (m_next.isToJoinAnd()) {
    g.setColor(Color.magenta);
    g.fillOval(to.x - 3,to.y - 3,6,6);
  }
  if (m_description != null) {
    Graphics2D g2D=(Graphics2D)g;
    Font font=new Font("Dialog",Font.PLAIN,9);
    if (m_next.isUnconditional())     g2D.setColor(Color.black);
 else     g2D.setColor(Color.red);
    TextLayout layout=new TextLayout(m_description,font,g2D.getFontRenderContext());
    int x=0;
    if (from.x < to.x)     x=from.x + ((to.x - from.x) / 2);
 else     x=to.x + ((from.x - to.x) / 2);
    int y=0;
    if (from.y < to.y)     y=from.y + ((to.y - from.y) / 2);
 else     y=to.y + ((from.y - to.y) / 2);
    y-=(layout.getAscent() - 3);
    x-=(layout.getAdvance() / 2);
    if (x < 2)     x=2;
    layout.draw(g2D,x,y);
  }
}

public void paint ( Graphics g ) { if ( m_from == null || m_to == null ) return ; Polygon arrow = new Polygon ( ) ; Point from = null ; Point to = null ; if ( isRightTop ( ) ) { from = addPoint ( arrow , m_from , SwingConstants . RIGHT , true ) ; to = addPoint ( arrow , m_to , SwingConstants . TOP , false ) ; } else if ( isBottomTop ( ) ) { from = addPoint ( arrow , m_from , SwingConstants . BOTTOM , true ) ; to = addPoint ( arrow , m_to , SwingConstants . TOP , false ) ; } else if ( isTopBottom ( ) ) { from = addPoint ( arrow , m_from , SwingConstants . TOP , true ) ; to = addPoint ( arrow , m_to , SwingConstants . BOTTOM , false ) ; } else if ( isLeftRight ( ) ) { from = addPoint ( arrow , m_from , SwingConstants . LEFT , true ) ; to = addPoint ( arrow , m_to , SwingConstants . RIGHT , false ) ; } else { from = addPoint ( arrow , m_from , SwingConstants . RIGHT , true ) ; to = addPoint ( arrow , m_to , SwingConstants . LEFT , false ) ; } if ( ! m_next . isUnconditional ( ) ) { g . setColor ( Color . red ) ; g . fillPolygon ( arrow ) ; } if ( m_visited ) g . setColor ( Color . green ) ; else g . setColor ( Color . black ) ; g . drawPolygon ( arrow ) ; if ( m_next . isFromSplitAnd ( ) ) { g . setColor ( Color . magenta ) ; g . fillOval ( from . x - 3 , from . y - 3 , 6 , 6 ) ; } if ( m_next . isToJoinAnd ( ) ) { g . setColor ( Color . magenta ) ; g . fillOval ( to . x - 3 , to . y - 3 , 6 , 6 ) ; } if ( m_description != null ) { Graphics2D g2D = ( Graphics2D ) g ; Font font = new Font ( "Dialog" , Font . PLAIN , 9 ) ; if ( m_next . isUnconditional ( ) ) g2D . setColor ( Color . black ) ; else g2D . setColor ( Color . red ) ; TextLayout layout = new TextLayout ( m_description , font , g2D . getFontRenderContext ( ) ) ; int x = 0 ; if ( from . x < to . x ) x = from . x + ( ( to . x - from . x ) / 2 ) ; else x = to . x + ( ( from . x - to . x ) / 2 ) ; int y = 0 ; if ( from . y < to . y ) y = from . y + ( ( to . y - from . y ) / 2 ) ; else y = to . y + ( ( from . y - to . y ) / 2 ) ; y -= ( layout . getAscent ( ) - 3 ) ; x -= ( layout . getAdvance ( ) / 2 ) ; if ( x < 2 ) x = 2 ; layout . draw ( g2D , x , y ) ; } }
paint it . coordinates based on wfcontentpanel .
