if (layoutMgr instanceof LayoutManager2) { LayoutManager2 lm2 = (LayoutManager2) layoutMgr; return lm2.getLayoutAlignmentX(this); } else
  public float getAlignmentX()  {    if (layoutMgr instanceof LayoutManager2)      {        LayoutManager2 lm2 = (LayoutManager2) layoutMgr;        return lm2.getLayoutAlignmentX(this);      }    else      return super.getAlignmentX();  }