I'm writing a java program that adds event handlers dynamically on the go on instructions by the user. My problem is, that how do I basically add them?

Call the add...Listener method for the component that generates the event.

Most commonly know as observer pattern (Head First Design Pattern, very handy book for fresh developers)

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.