Force-feedback and channeling energy

It's important to correct bad habits immediately. This can be something as simple as dropping your head on the serve or not properly preparing your footwork to hit a down the line forehand, or it can be a poor decision such as trying to hit a drop shot when your opponent is quick and already creeping inside the baseline.

The first phase of this correction process takes a good amount of self-awareness and understanding the basic foundational knowledge of the game.

The second phase is immediately halting that bad action - getting pissed off, yell out at yourself or hitting yourself. Andy Murray punches his strings until his knuckles start bleeding. This is the same principle of Pavlov's dog (ring bell and the dog barks). Negative stimulus for bad actions *immediately*.

The third phase is realizing what the proper decision or execution should have been.  When you move well, earn short balls, and execute to finish a well constructed point, you need to pump your fist (Nadal) or yell out "come on" (Hewitt) so that you re-enforce good habits. Anything you can do to reward yourself immediately for the right choice.

*Important* This is a very tricky technique to apply mainly because sometimes people get too caught up in feeling negative for bad Results (I lost the point), rather than acknowledge that either your opponent actually hit an amazing shot.  Actually in this case, you should applaud your opponent's good shot (recognition of excellence that you should strive for) and also so you don't punish yourself for possibly playing a good point but just had a bad result or an unfortunately net cord made you lose the point.  If you are not careful, you can actually over-compensate and start removing Good habits too*

Lastly, this enforcement technique requires a fairly high pain threshold and good sensitivity and self-awareness in your tennis mind and body.  I am not advocating that every player go out there and punch their strings if they hit a double fault (you would need a lot of bandaids and your game might suffer from a bleeding fist, as you'll need many hours of training and re-conditioning to achive the proper serve).

Anger (and anger-management)
This topic goes to the sports psychology of the John McEnroe blow-up and how doing so actually helped him use this emotion (not always detrimental) to take him out of his current mindset and focus that anger toward winning the next point.  Getting really angry is normal, it is human.  Some channel that Energy though into smashing rackets with all their hate or cursing to the heavens/their box/themselves. This is not helpful, and although it may unleash some of your pent up hostility, it does not address the source of the problem nor provide a solution.

Controlling intense emotions (Anger) and transferring them to positive actions.
What you must learn to do is to control/channel that intense hatred or anger into something positive.  Example: "I swear I am not going to hold back on my 2nd serve returns anymore!" Yell this to yourself, either in your mind or scream it out loud if you need to.  But it should be jarring enough of an action to force change and gives your mind and body feedback for your actions.  Sometimes I'll jettison a few old balls into the stratosphere for good measure in practice.

Hate Losing, Failing with all your heart and soul...associate that with Pain
Pete Sampras has also revealed in his biography that during one of his early Grand Slams he had played really hard to reach the Finals and upon doing so, simply loss out of having reached his goal of a final and being satisfied with what he had already achieved.  There was no incentive or drive to win one more for the title. He had lowered his expectations so that he wouldn't feel disappointed.

However, immediately after this final, he felt a great sense of regret, pain, frustration and sheer anger at himself for being content to "just get there" (complacency).  He made a note of how terrible he felt that night, made the loss as memorable (painful) as possible to himself, and swore to never let that happen that he would never feel so self-betraying again.