Being respectful in a court setting is vital. It is why you are supposed to wear formal clothing while inside. In fact, disrupting a court session is illegal, and you can be arrested and charged with contempt of court. Perhaps the most important reason to be respectful is because the court is what will decide your fate. If you give a bad impressions, there is usually not a very good fate for you.
However there are cases where the defendant just doesn’t care. Since he had to fart, he just decided to fart regardless of any possible repercussions.