In this case, chat and game windows will be considered Observers. You will want to implement an interface called “Observers” (the java API has its own Observer template on java.util.Observer, but you can implement it), and your chat and whiteboard window implements them. Perhaps it looks like this:
public interface Observer
{
public void postUpdate(String newData);
}
postUpdate - , , , , Observer, :
public class ChatWindow Implements Observer
{
}
public void addObserver(Observer newObserver)
{
}
addObserver , , , , , postUpdate. , , , . , , , , ; , , , , , , , (, , , - ).
Head First Design Patterns .