Former world number one Roger Federer says he is glad he has matured mentally since he first started playing on tour.