Event handling in java, for a vb.net expert
问题 I found tons of posts about handling events of existing java classes, but nothing about creating a class with events from scratch. What is the translation to java of this vb.net snippet? Public Class TestClass Event TestEvent() Sub TestFunction() RaiseEvent TestEvent() End Sub End Class Public Class Form1 Dim WithEvents TC As New TestClass Sub OnTestEvent() Handles TC.TestEvent End Sub End Class Thanks. 回答1: Here's a good link on the "theory" behind the Java event model: http://docs.oracle