| 12
 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
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 
 |  
/*
 * Main.fx
 *
 * Created on Jun 12, 2009, 8:34:50 AM
 */
 
package listview;
 
import javafx.stage.Stage;
import javafx.scene.Scene;
 
import javafx.scene.control.ListView;
 
import javafx.animation.transition.SequentialTransition;
 
import javafx.animation.transition.PauseTransition;
 
/**
 * @author fabriceb
 */
def list:ListView = ListView {
    width: bind list.scene.width;
    height: bind list.scene.height;
    items: [ ##"Zero", ##"One", ##"Two", ##"Three", ##"Four", ##"Five", ##"Six",
    ##"Seven", ##"Height", ##"Nine", ##"Ten"]
}
def index = bind list.selectedIndex on replace {
    println("Index changed {list.selectedIndex}");
}
def value = bind list.selectedItem on replace {
    println("Value changed {list.selectedItem}");
}
Stage {
    title: ##"ListView test"
    width: 250
    height: 150
    scene: Scene {
        content: list
    }
}
println("Selecting last row");
list.selectFirstRow();
println("{list.selectedIndex} {list.selectedItem}");
def anim = SequentialTransition {
    content: [
        PauseTransition {
           duration: 2s;
           action: function():Void {
               println("Selecting last row");
               list.selectLastRow();
               println("{list.selectedIndex} {list.selectedItem}");
           }
        }
        PauseTransition {
           duration: 2s;
           action: function():Void {
               println("Selecting first row");
               list.selectFirstRow();
               println("{list.selectedIndex} {list.selectedItem}");
           }
        }
    ]
}
anim.playFromStart(); |