java - How to get source object from DocumentListener (DocumentEvent)? -
this question has answer here:
i have class , have implemented documentlistener
public void removeupdate( documentevent arg0 ) { system.out.println( arg0.getdocument()); }
it print javax.swing.text.plaindocument@49ea903c
is there possible way object can value of changed textfield? @ moment have 1 field not need check, if use 2 or more, how know jtextfield
has notified listener?
i'm not sure it's possible swing component document. issue solved: add different instance of listener every text field, , store text field in listener itself.
textfield1.getdocument().adddocumentlistener(new mydocumentlistener(textfield1)); textfield2.getdocument().adddocumentlistener(new mydocumentlistener(textfield2)); textfield3.getdocument().adddocumentlistener(new mydocumentlistener(textfield3));
Comments
Post a Comment