[Solved] Why is the comma in two text fields put at the same time without focusing?
Why is the comma placed without focusing text fields? Because you are using the global keyPressed() event. This condition: if (e.getKey() == ‘,’) checks that the , key is pressed and it’s redundant to check twice in your case. It’s equivalent to this simpler/cleaner snippet: public void keyPressed(KeyEvent e) { if (key == ‘,’){ X9.setText(X9.getText() … Read more