Weapons are not allowed in court.
That may have changed over the years. I can remember thirty years ago that officers were not even allowed to carry in the courtroom. I've seen quite a few take the stand with an empty holster. Years went by and I went to court one day and asked where I needed to store my pistol. The clerk told me " we don't do that anymore, the judges want officers armed." Skeptical, I took the stand with my pistol still in the holster and not a word was said about it.
Things could have changed back since I retired in 2007. I've been to court as a juror once since then and the testifying officer was wearing his.