Many students fled the building, while others were told to shelter in place. The alleged gunman left the classroom, but police were unsure for about two hours if he was still on campus.
Nearby public schools were locked down.
Students and staff at the college described the situation as unnerving even though the weapon was not fired and no one was hurt. Diane Kae, the assistant director of admissions, has an office in the building where the gun was allegedly displayed.
"When a cop comes in your office and tells you to 'get out now!' you take that seriously," she told WCAU-TV.
Law enforcement sources identified the student with the gun as Ryan Fitch, 23, WCAU reported. Police discovered that he was no longer on campus when they called his father.
By late afternoon, the campus was back to normal and Fitch was in custody. A police official said the college has a no-weapons policy and Fitch should not have been carrying the gun, even if he had a license for it.