import tfd.scala.squib._ import tfd.scala.squib.event._ import javax.swing.{JButton, WindowConstants} var clickCount = 0; def clickCountText = "ClickCount: " + clickCount val clickCountLabel = label("clickCount", 'text->clickCountText) frame( 'title -> "Press Me", 'visible -> true, 'defaultCloseOperation -> WindowConstants.DISPOSE_ON_CLOSE, 'layout->gridlayout('rows->2, 'columns->1), contents( button('text->"Press Me", actionPerformed { clickCount += 1 clickCountLabel.setText(clickCountText) } ), clickCountLabel ) ).pack