A judge in West Texas said a prosecutor who suggested that Mr. Nelson perform in a courtroom was making a joke that "got out of hand."