package gui_elements;

import javafx.scene.control.TextField;
import javafx.scene.input.KeyEvent;


/**
 *
 */
public class FloatField extends TextField {
    public FloatField() {
        this.addEventFilter(KeyEvent.KEY_TYPED, t -> {
            char ar[] = t.getCharacter().toCharArray();
            char ch = ar[t.getCharacter().toCharArray().length - 1];
            if (!((ch >= '0' && ch <= '9') || ch == '.')) {
                t.consume();
            }
        });
    }

    public float getValue() {
        return Float.parseFloat(getText());
    }
}

@@ -400,16 +400,17 @@
 '9') %7C%7C 
+(
 ch == '.
@@ -410,16 +410,44 @@
 h == '.'
+ & !getText().contains(%22.%22))
 )) %7B%0A   

Fix the bug that allowed to type more than one period in a float number.