Animation in OpenLayer-Wraper For Vaadin 6


I want to implement a function like this: I have checked the code: I want to add a polyline on the map per second. In a button-click listener function, I start a new thread to run the add-polyline function. But the polylines always show together at the last second. Does anyone know why about this or can anyone give me some suggestions or some source code?

Here is my code:

button.addListener(new ClickListener() {
    private static final long serialVersionUID = 1L;
    public void buttonClick(ClickEvent event) {
        for(int i = 1; i<3;i++){
            Thread draw = new Thread(new Draw(i));

    class Draw implements Runnable{
        private int i;
        public Draw( int i){
            this.i = i;
        public void run() {
            // TODO Auto-generated method stub
            try {
            } catch (InterruptedException e) {
                // TODO Auto-generated catch block
            synchronized (getApplication()){

Thanks very much for any help.