I must make a nickname, and I do everything, using KeyListener. I want to write nickname using keyTyped, but I have no idea, how to save each letter. For exaple:
keyTyped(KeyEvent e){
char key = e.getKeyChar();
nick = new String[10];
for(int i = 0; i<10; i++){
nick[i] = Character.toString(key);
key = e.getKeyChar();
}
}
Unfortunately, every letter is the last one typed. How to do it?
Aucun commentaire:
Enregistrer un commentaire