I got pantsed in High school during gym one day, thank god my boxers stayed up, but pissed me off nonetheless. Only time in high school I came close to beating someone's ass.
After reading some of the other comments, this sounds like it is a bit of a different scenario with OP being a female, but if you are feeling distressed about it, you should tell someone and tell someone who will do something. Talk to a counselor or an administrator. At the very least, you should talk about it to your parents. If you are just embarrassed in the sense of doing something stupid and everyone seeing it, then use your best judgement, but if it was more than that, then make sure the classmate is at least brought in to apologize by an administrator.
Don't feel bad, happened to me once in gym class during high school. Just the class douche being his usual self, so I just played it off and joked him for wanting to see me with my pants down. :P