I want to know about how to set our own Listeners in java.For example I have a function that increments number from 1 to 100. i want to set a listener when the value reaches 50. How can i do that? Pls suggest me any tutorial.
Have a look at the source of any class that uses listeners. In fact it's quite easy:
MyListener
MyListener
As for the observer pattern along with some Java code have a look at wikipedia.