You pretty much just have to condition yourself. I presume you cramped at the latter stages of your match. The fitter and stronger your muscles are, the less chance of cramp. That's the best i can come up with. Take Dominik Hrbaty, he doesn't cramp frequently, he cycles up mountains for leisure!
All of the above: your body needs sodium and potassium for the conduction of nerve impulses. You'd want to drink water before and during the match, banana's are a good source of potassium, or otherwise (or additionally) get whatever drink Dina's talking about that contains the minerals. But conditioning is very important too: run like Lleyton (for eg. ) and you'll adapt physiologically: your aerobic respiration will improve and you'll be able to overcome a buildup of lactic acid in the muscles, etc.
You can try eating some dried salted herring during the changeover. It is a good source of sodium and potassium. In my younger years that was what mountain climbers were eating to keep themselves going.