In our local kids rec league, we have at least one of the Board members at every game. If a spectator says or does anything inappropriate, the Board member deals with it up to and including ejection. If the person is ejected, they cannot attend any more games that season unless they appeal to the Board and are reinstated.
And now for something different. Back in HS (a few centuries ago) we used to have a chant we would yell when an opponent was going to shoot an "important" free throw. It was "See that basket, see that ball, c'mon stupid, hit the wall".