FileDocCategorySizeDatePackage
CharacterEventHandler.javaAPI DocExample683Mon Mar 08 22:02:54 GMT 2004javathreads.examples.ch07

CharacterEventHandler

public class CharacterEventHandler extends Object

Fields Summary
private Vector
listeners
Constructors Summary
Methods Summary
public voidaddCharacterListener(CharacterListener cl)


        
        listeners.add(cl);
    
public voidfireNewCharacter(CharacterSource source, int c)

        CharacterEvent ce = new CharacterEvent(source, c);
        CharacterListener[] cl = (CharacterListener[] )
                                 listeners.toArray(new CharacterListener[0]);
        for (int i = 0; i < cl.length; i++)
            cl[i].newCharacter(ce);
    
public voidremoveCharacterListener(CharacterListener cl)

        listeners.remove(cl);