Scala property bindings -


GPLv3
跨平台
Scala

软件简介

This library provides property bindings similar to Qt signal slot system,
JavaFx’s properties and other.

示例程序:

private class Model {
  val text = new Observable("count: 0")
  private var count = 
  def increment() {
    count += 1
    text() = "count: " + count
  }
}

object Example extends SimpleSwingApplication {
  private val model = new Model

  def top = new MainFrame {
    title = "Example"
    contents = new GridPanel(2, 1) {
      val button = new Button("Press Me!")
      contents += button

      val label = new Label {
        text = observes(model.text, text_=)
      }
      contents += label

      listenTo(button)
      reactions += {
        case ButtonClicked(_) => model.increment()
      }
    }
  }
}