0
I’m studying about vectors, and I want to create a program that, by typing a password(only letters) in the text field and pressing a button, the program would exchange the text of the password label for what I typed in the textfield, but I’m not able to think of a way to put the letters of the password vector in lbpassword
b.addMouseListener(new MouseAdapter() {
@Override
public void mouseClicked(MouseEvent e) {
super.mouseClicked(e);
String s = tf.getText();
String[] senha = new String[s.length()];
//letras
for (char letra = 'a'; letra <= 'z'; letra++){
//percorrer as letras da senha
for (int i = 0; i == s.length(); i++) {
//para cada espaço no vetor adiciona uma letra do txtfield
senha[i] = String.valueOf(s.charAt(i));
//se a letra percorrida for igual a letra do vetor senha[]
if(senha[i] == String.valueOf(letra)){
//senha recebe a letra
senha[i] = String.valueOf(letra);
//trocar o texto do label pela senha
lbsenha.setText(senha[i]+senha[i++]);
}
}
}
}
});