Fandom

Planet JFX

Introduction to Binding: Example 2

118pages on
this wiki
Add New Page
Talk2 Share

Ad blocker interference detected!


Wikia is a free-to-use site that makes money from advertising. We have a modified experience for viewers using ad blockers

Wikia is not accessible if you’ve made further modifications. Remove the custom ad blocker rule(s) and the page will load as expected.

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
}

Also on Fandom

Random Wiki