To implement java event