Darren Dixon was told he could be found in contempt if he returned to Selkirk Sheriff Court in similar attire.
The 27-year-old had admitted breaking his girlfriend's tablet during a row over a George Foreman grill, when he received the dressing down.
Sheriff Peter Paterson said; "If you turn up to court in shorts again you will be held in contempt of court.
"It is completely unacceptable."
Dixon, of Galashiels, apologised for wearing the long blue shorts.
He was fined Â£125 for the criminal offence and ordered to pay his ex-girlfriend Â£100 in compensation.
A man who wore shorts in court on one of the hottest days of the year has been reprimanded by a sheriff.