init variables and paint event