Fandom

Planet JFX

Introduction to Binding: Example 3

118pages on
this wiki
Add New Page
Talk1 Share
import javafx.ui.*;

class Counter {
	attribute value: Integer;
	operation increase( );
	operation decrease( );
}

attribute Counter.value = 0;

operation Counter.increase( )
{
	value++;
}

operation Counter.decrease( )
{
	value--;
}

var count:Counter = new Counter( );

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

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.

Also on Fandom

Random Wiki