added println in buttonPressed function