Como funciona o bind do JAVAFX

0 respostas
L

[size=18]Qual é o probelma desse código?[/size]

/*

  • Main.fx
  • Created on 05/06/2009, 12:47:45
    */

package javafx2;

import javafx.stage.Stage;

import javafx.scene.Scene;

import javafx.scene.control.Button;

import javafx.scene.control.TextBox;

import javafx.scene.control.Label;

/**

  • @author leonardo.fernandes
    */
    class Calculo {
    var operador1:String;
    var operador2:String ;
    var resultado:String ;
    public function soma(){
    resultado = String.valueOf( Integer.valueOf(operador1)+ Integer.valueOf( operador2));
    }
    }

var calc = Calculo{
};

Stage {

title: “Application title”

width: 200

height: 230

scene: Scene {

content: [
Label {
            translateX:10
            translateY:10
            text: "Numero1:"
        }


        TextBox {
            translateX:10
            translateY:25
            text:  bind calc.operador1;
            columns: 12
            selectOnFocus: true
           }
       Label {
            translateX:10
            translateY:70
            text: "Numero2:"
        }

       TextBox {
            translateX:10
            translateY:85
            text: bind String.valueOf(calc.operador2);
            columns: 12
            selectOnFocus: true
        }


        Label {
                translateX:10
                translateY:120
                text: bind  calc.resultado;
        }

            Button {
                translateX:10
                translateY:150
                text: "Somar"

                action: function() {
                    calc.soma();
                }
            }

    ]
}

}

Grato pela a atenção.

Criado 10 de junho de 2009
Respostas 0
Participantes 1