Does Java have native support for events, similar to that of C#?

前端 未结 9 2035
眼角桃花
眼角桃花 2020-12-19 03:19

I\'m a bit confused from what I\'ve heard Java doesn\'t do events.

But I know that it does GUI events.

Am I missing something? Does java have an event handli

9条回答
  •  没有蜡笔的小新
    2020-12-19 04:10

    You might also want to take a look at the open source EventBus library, which, contrarily to the standard publisher/subscriber pattern uses a mediator class (the event bus) in order to reduce the tight coupling required in publisher/subscriber pattern (where subscribers must know about all publishers to register to them, which is not always possible and is often cumbersome).

    I have used it in GUI applications but it can deal with any kinds of event.

提交回复
热议问题