Add synchronized to paintChar.