Abstract: The idea of this research is how to program event driven systems such as graphical user interfaces, games which can be modeled with Petri nets, a graphical and mathematical modeling tool, using their incidence matrices and a suggested program structure. Incidence matrix defines and analyzes completely the dynamic behavior of Petri nets by some equations. In this way, a numerical method could achieve to adapt the program behavior easily with benefits of using the analysis power of Petri nets. The suggested program structure decomposes the overall program into 3 parts: the event handlers library part, the driver routine part and a resource file part containing the incidence matrix. In this manner the program reusability will increase and simplify the program adaptability process and shorten the program construction life time.