I am trying to add key press events to my library, so is it possible to pass a function as a parameter to one of my library's classes, then when my library needs to fire off that function?
example:
Library lib = new Library();
lib.myAction(function(){
// Do some java stuff here
});
So with that, when my library see something take place, such as a key press, it will fire off that function. If you have every worked with JavaScript you can do this (Really common with jQuery), and I would like to have the same effect but with Java.
enumthat represent eachfunction()then pass that?CommandorStrategydesign pattern