There really isn't much information to go on yet. His panting could be due to stress, pain, or fear. There can also be medical causes such as neurological problems, respiratory disorders, and Heart problems such as heartworm, anemia, and fever.
Since he is not eating, I'm going to assume the panting is from pain. Check your dog's mouth for tartar on the teeth, possibly red gums, darkened teeth, broken teeth or something caught between the teeth or gums. If you find something stuck, try and remove it. If it is bad teeth, you can give him Buffered aspirin can be given to a dog with a dosage of up to 5 mg per pound every 12 hours. Keep in mind that a dog's body does not metabolize aspirin in the same way as a human and thus should not be given more than a day or two without contacting your Vet.
A second possibility might be a touch of pancreatitis or a stomach ache from something he ate that disagreed with him. Usually you see vomiting and diarrhea with this, but if he isn't vomiting, he might just have the stomach ache (cramps).. You can read about this here:
You might try some pepcid and see if this makes him feel better. Read about Pepcid dosages and usage information here: http://www.petplace.com/drug-library/famotidine-pepcid/page1.aspx
Put a drop of pancake syrup on your dog's tongue to keep your dog's glucose level up and replace water with pedialyte or if you don't have any add a pinch of sugar and salt to the water. After that offer small portions of bland food such as boiled chicken and rice to see how the dog's system does with that. If your dog does fine, you can slowly reintroduce your dog's regular food into the chicken and rice mixture until it is all regular food.
If your dog's stomach is bloated, then you might be looking at bloat, but you haven't indicated other symptoms associated with that. I'll include a link so you can check the other symptoms.
Since you didn't indicate if he had had a bowel movement or if he ingested bones and non food items, constipation or an intestingal obstruction might also be the problem.
If your dog is experiencing constipation on a regular basis you should add roughage to his diet such as canned pumpkin (not pie filling kind) or Metamucil. A spoon full of pumpkin on the dog's food should keep his bowels hydrated and his feces soft enough to pass.
A spoon of mineral oil on his food can also be used but should not be used all the time.
There are two methods I use for young puppies, which may work on your dog. I first try lubricating a rectal thermometer and take the puppies temperature. This frequently stimulates the puppy into going. If this fails and you have a nasal bulb syringe (aspirator), you can put warm water in it and gently squeeze a small amount into the rectum and see if this doesn't help.
You can use a children's glycerin suppository depending on the size of your dog but the other methods are what I recommend you try first
IMPORTANT NOTE If your dog ate a non-food item, bone or rawhide recently or if your dog is experiencing other symptoms such as vomiting, not eating or drinking, severe abdominal pain, the dog needs to see a vet. The above signs could indicate an intestinal obstruction, which you can read about here:
if your dog becomes dehydrated. You can tell by pulling up the skin between his shoulder blades and seeing if it flows back down normally. If it stays tented or is slow to return to normal, your dog is dehydrated and needs fluids immediately and should see a vet as soon as possible.
If gums and tongue become pale and not a normal pink color or the rectal temperature is over 103F (101-102F is normal) or your dog becomes lethargic and non-responsive, your dog should also see a vet as soon as possible.
I hope you find this information helpful.