Energy balance of stellar coronae. I - Methods and examples. II - Effect of coronal heating