The student showed the gun to another student, who told a teacher.
The student then gave the gun to a security officer, and no one was injured.
There is no word yet on whether the weapon was loaded.
A school district spokesperson says the seventh grader showed the gun to another student, who alleged he was threatened and reported it to a teacher.
The teacher notified school administration, who notified the security officer and called police.
The child's parents were notified and police took him into custody.