I need to click on the Clear button on the Login screen, the CPF and Password the cursor will return to the CPF field.
JFormattedTextField ftUsuario = new JFormattedTextField();
try {
MaskFormatter formatter;
formatter = new MaskFormatter("###.###.###-##");
formatter.setPlaceholderCharacter('#');
ftUsuario = new JFormattedTextField(formatter);
} catch (Exception e1) {
JOptionPane.showMessageDialog(null, "Informe o seu CPF", "Aviso!", JOptionPane.INFORMATION_MESSAGE);
}
JButton btnLimpar = new JButton("Limpar");
btnLimpar.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
pfSenha.setText(null);
ftUsuario.requestFocus(); // AQUI É EXIBIDO O ERRO...
}
});