Hello,

I am making an IRC application and I was wondering how I could make a simple event that gets called like onMessage() every time a IRC message comes through so I can then do something like this in my main class:

public void onMessage(String message){
    System.out.println(message);
    //or Handle commands
}

I think it has something to do with interfaces but I can't find a tutorial on how I could do this. I am still learning about java. Thanks

Recommended Answers

It's called the "Observer" pattern - sorry, no time to explain right now, but Google it for lots of examples etc.

Jump to Post

All 2 Replies

It's called the "Observer" pattern - sorry, no time to explain right now, but Google it for lots of examples etc.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts learning and sharing knowledge.