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

Popular posts from this blog

SPSS keyboard combination alters encoding -

Add new record to the table by click on the button in Microsoft Access -

CSS3 Transition to highlight new elements created in JQuery -