I want to pass a variable into a CaretListener when my JTextFiled is update.
My listener work perfectly thanks to "caretUpdate".
However, I don't know how to pass a variable to my "caretUpdate", like "e.getActionCommand()" when I used "actionPerformed" but it's seem to not exist for "caretUpdate", is there a solution ?
Edit : In My view I have a textField witch is attach to a listener :
textField.setActionCommand("test");
textField.addCaretListener(this.controller);
In My controller I have the listener, and I want to get the value "test" :
public void caretUpdate(CaretEvent e) {
// here I want to get the "test" value
String maVar = e.getActionCommand();
}
But e.getActionCommand() doesn't exist for CaretEvent. Is there an alternative ?