Wikia

Planet JFX

Introduction to Binding: Example 2

118pages on
this wiki
Talk2
import javafx.ui.*;

class Counter {
	attribute value: Integer;
}
attribute Counter.value = 0;

var count:Counter = Counter {};

Frame {
	title: "Bind Example 2"
	width: 300
	height: 75
	content: 
		FlowPanel {
			content: [
				Label {
					text: bind count.value.toString( ),
				},
				Button {
					text: "Add 1"
					action: operation () {
						count.value = count.value + 1;
					}
				},
				Button {
					text: "Subtract 1"
					action: operation () {
						count.value = count.value - 1;
					}
				}
			]
		}
	visible: true
}

Around Wikia's network

Random Wiki