FileDocCategorySizeDatePackage
CharacterEventHandler.javaAPI DocExample715Sat Apr 17 22:02:08 BST 2004javathreads.examples.ch08.example1

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);