A judge told James Cox he would have to "live with the shame for the rest of his life".