'The righteous one will rejoice in Hashem.' (Psalms 64:11)
If someone recently experienced a great thing in his life: he just got the job of his dreams, he won a great award, he had his first child or grandchild, the person whom he or she was hoping to marry said yes, that house that he considered ideal just became available at a price he could afford, then one's thoughts will be totally focused on the good thing.
Regardless of where a person is, the outside circumstances are not where his mind is. His mind is full of joyful celebration, whether he is by himself or with others.
Such is the mind of the righteous. They are always thinking of Hashem. They are thinking thoughts of studying Torah, or praying to Hashem, and reciting blessings for all the good in their lives, and thoughts of kindness which is emulating the ways of Hashem by being kind to His children. Thinking of Hashem gives them joy, and they are always thinking of Hashem. This is an amazing goal toward which to strive.
(Growth Through Tehillim: Exploring Psalms for Life Transforming Thoughts, p. 150)