I'm trying to call method after changing text of JTextField.
textField.getDocument().addDocumentListener(new DocumentListener()
{
public void changedUpdate(DocumentEvent arg0)
{
System.out.println("IT WORKS");
panel.setPrice(panel.countTotalPrice(TabPanel.this));
}
public void insertUpdate(DocumentEvent arg0)
{
}
public void removeUpdate(DocumentEvent arg0)
{
}
});
When I call this method at another ActionListener, it works ok. But when I change text in text field, nothing happens. Even println. Any suggestions?
textField
? If so, you can't because document listeners can't change the value in the text field they're assigned to. – Melloney