Polygon arrow = getArrow(dir, 10); if (getIcon() == null) setIcon(new arrowIcon(arrow)); else ((arrowIcon) getIcon()).setArrow(arrow);
  public void setDirection(int dir)  {    Polygon arrow = getArrow(dir, 10);    if (getIcon() == null)      setIcon(new arrowIcon(arrow));    else      ((arrowIcon) getIcon()).setArrow(arrow);    this.direction = dir;  }