1 Reply Latest reply: Jan 23, 2013 4:11 AM by Narayan RSS

    how to round a double value in @fxml textFields ie 64.34 to 64

    TAJDIN
      Sir.

      how to round a double value in @fxml textFields ie 64.34 to 64.

      Regards
        • 1. Re: how to round a double value in @fxml textFields ie 64.34 to 64
          Narayan
          Hi tanvir,

          Add valueChanged Listener and set the value of textfield like below. Suppose "txt" is your Textfield variable name
          //.. your change listener override function     {
          try{
               Double d= Double.parseDouble(txt.getText());
               String.format("%.2d")
          }catch(NumberFormatException nfe){
               System.out.println(nfe.getMessage());
          }
          // }
          Thanks
          Narayan