Be conscious of your thoughts:

As soon as you find yourself thinking a negative thought, stop yourself; think of something positive/something that makes you happy instead. (Have a ‘standby’ thought ready!)