avoiding duplication of paint code to achieve flashing of pushed button