Created
August 15, 2010 05:29
-
-
Save polypus74/525124 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import org.jfxtras.lang.XBind; | |
import javafx.stage.*; | |
import javafx.scene.*; | |
import javafx.scene.layout.HBox; | |
import javafx.scene.control.*; | |
function run():Void { | |
try { | |
def lab = Label { text: "->" }; | |
def ctx = javafx.reflect.FXLocal.getContext(); | |
def labMirror = ctx.mirrorOf(lab); | |
def x = XBind.bindTo(labMirror, labMirror.getType().getVariable("text")); | |
// if i comment this label out then the listener is not called | |
Label { text: bind x.ref as String; } | |
x.addListener(function(x:Object, y:Object):Void { Alert.inform("changed") }); | |
Stage { | |
scene: Scene { | |
content: HBox { | |
content: [ | |
Button { | |
text: "->" | |
action: function():Void { | |
lab.text = "{lab.text} ->"; | |
} | |
}, | |
lab | |
] | |
} | |
} | |
} | |
} catch (x: java.lang.Exception) { | |
Alert.inform("{x}"); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment