/
NumericPropertiesExample.scala
52 lines (41 loc) · 1.11 KB
/
NumericPropertiesExample.scala
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
package proscalafx.ch03
import scalafx.beans.property.{DoubleProperty, FloatProperty, IntegerProperty, LongProperty}
object NumericPropertiesExample extends App {
val i = new IntegerProperty(null, "i", 1024)
val l = new LongProperty(null, "l", 0L)
val f = new FloatProperty(null, "f", 0.0f)
val d = new DoubleProperty(null, "d", 0.0)
println("Constructed numerical properties i, l, f, d.")
println("i = " + i())
println("l = " + l())
println("f = " + f())
println("d = " + d())
l <== i
f <== l
d <== f
println("Bound l to i, f to l, d to f.")
println("i = " + i())
println("l = " + l())
println("f = " + f())
println("d = " + d())
println("Calling i.set(2048).")
i() = 2048
println("i = " + i())
println("l = " + l())
println("f = " + f())
println("d = " + d())
d.unbind()
f.unbind()
l.unbind()
println("Unbound l to i, f to l, d to f.")
f <== d
l <== f
i <== l
println("Bound f to d, l to f, i to l.")
println("Calling d.set(10000000000L).")
d() = 10000000000L
println("d = " + d())
println("f = " + f())
println("l = " + l())
println("i = " + i())
}