how to find source component that generated a DocumentEvent

前端 未结 3 1760
眼角桃花
眼角桃花 2020-12-05 19:27

Is it possible to discover which oject generated a DocumentEvent? Something like i can do with ActionListener:

JTextField field = new JTextField(\"\");
field         


        
3条回答
  •  天命终不由人
    2020-12-05 20:02

    Rather than add multiple fields to the same listener. Create a custom listener that upon creation takes a reference to the text field. Then create a new instance of the listener each time you add it to a field.

提交回复
热议问题