Estou tentando usar o evento FocusListener, mas quando eu entro no objeto ele dispara os dois eventos de focus o de entrada e o de saida … infinitamente
[code]
try
{
format_textCodigo = new MaskFormatter("#####");
edtCodigo = new javax.swing.JFormattedTextField(format_textCodigo);
edtCodigo.setFocusLostBehavior(JFormattedTextField.COMMIT);
edtCodigo.setColumns(5);
}
catch(Exception e) {}
edtCodigo.addFocusListener(
new FocusAdapter(){
public void focusLost(FocusEvent e)
{
JOptionPane.showMessageDialog(null,edtCodigo.getText());
}
public void focusGained(FocusEvent e)
{
JOptionPane.showMessageDialog(null,edtCodigo.getText()+“Gained”);
}
}
);[/code]