Move panel rendering code in panel class