I am making a little Sudoku game with a GUI and use a MaskFormatter for the JFormattedTextFields:
formatter = new MaskFormatter(s);
formatter.setValidCharacters("123456789");
But my problem is that when the window opens and i click into one of those fields, it is not possible to type something,
it only works on second try, namely when I click into another field and then back to the first one.
Is it like it has to lose focus first to activate?
If some of my code is necessary please let me know.
Here's what it looks like
EDIT: The problem was here:
if (guessMatrix[i][j] == 0) {
tfM[j][i].setBackground(Color.yellow);
tfM[j][i].setText("");
Without the setText("") it works perfectly fine.