Making a libgdx textfield ignore certain characters?
java, libgdx, textfield, user-interface
Solution
I never worked with TextFieldFilters cause i am almost new to libgdx. But as much as i understood you use them like this:
myTextfield.setTextFieldFilter(new TextFieldFilter() {
// Accepts all Characters except 'a'
public boolean acceptChar(TextField textField, char c) {
if (c == 'a')
return false;
return true;
}
});
Hope it helps. Please tell me if it works because i want to use this TextFieldFilters to :P
Problem
Hi I'm stuck with a problem I don't seem able to solve regarding a TextField for libgdx. I want to ignore certain characters such as instead of writing a space in the textfield when using "shift" for a upper-case character. As of currently I've written like this. ``` accField.setTextFieldListener(new TextFieldListener() { public void keyTyped(TextField textField, char c) { if (c == 'a') { //Something here that does the replacement maybe? } } }); ```