begin coding for Painter.(Not finished.)