It’s not because of the difference between a courthouse and an airport. The reason why metal detectors are OK in courthouses, and why genitalia pat-downs are NOT OK at airports, is because of the difference in the “search.”
Walking through a metal detector is a REASONABLE search. Having your (and your Grandma’s and your 6-year-old’s) crotch probed is NOT.
I don’t even like the metal detectors at the courthouse. It is an intrusion into my personal affairs and a limitation on my right to carry tools and even weapons. Weapons carried by normal citizens do not make a courthouse less safe — they make it safer and the whole community too. When a citizen feels he can defend his own safety that is a better citizen and the whole community is better.