I have the following problem. I create a JTextField
JTextField t = new JTextField("2");
and then add a listener.
t.addKeyListener(new KeyAdapter()
{
@Override
public void keyPressed(KeyEvent e)
{
System.out.println(t.getText());
}
});
But the getText()
doesn't return the new text.
For example, if I type 5, getText()
still returns 2, the old text.