your code was not valid. i guess you meant this one?
button1.addEventListener("click", { println("button clicked") })
thanks that works. the only problem is that it only works once after the first click but does not write the same line again when i click the button a second time.