1 I want to know how to send and integer to the observer,the int is the loop count
2I have notifyobservers in a loop? Is that ok?
EVENT SOURCE
For (int I = 0; I<23;I ++) {
setChanged();
notifyObservers( ??? I ??? );
}
HANDLER
private int resp;
public void update (Observable obj, Object arg)
{
if ( ?? how do I say instance of int so I can check it)
{
System.out.println("\HERE IS THE INTEGER VALUE: "+ resp );
}
2) notifying may take a long time, that's the only problem. And if you are executing your code from a synchronized block / method, you could get possible deadlock problems (read Effective Java to see how this is possible).