The program is a 630 line code.
On any button click, it first disables the button so it can’t be clicked. Then it checks to see whether the winning criteria has been met or not. If it has been met then it display the winner. At the end, it checks whether the game has ended in a draw or not.
The code has also been uploaded on pastebin.com
The url is http://pastebin.com/GQ634xM1.