package com.softgraf.model;

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

public class Aceitar {

	public static void apenasInteirosPositivos(KeyEvent evento, int max) {
		char c = evento.getCharacter().charAt(0);
		int length = ((TextField) evento.getSource()).getText().length();
		if (c < '0' || c > '9' || length >= max)
			evento.consume();
	}
}
