0

How to add textbox change event in NetBeans' GUI builder:

I want my code to run when user changes jtextbox value. I tried nelow events but it doesn't executes.

    private void jTextInputMethodTextChanged(java.awt.event.InputMethodEvent evt) { 
 }

    private void jTextActionPerformed(java.awt.event.ActionEvent evt) {    
}
 private void jTextPropertyChange(java.beans.PropertyChangeEvent evt) {  
}

I research on internet and found solution as DocumentListener but I am not sure how and where to add listener code in Netbeans as most of the code is autogenerated in initComponents() which can not be edited.

Rajesh Mhatre
  • 147
  • 1
  • 1
  • 11
  • 1) For better help sooner, post a [MCVE] or [Short, Self Contained, Correct Example](http://www.sscce.org/). 2) Note that a text field will only fire an `ActionEvent` when the enter key is pressed. – Andrew Thompson Jan 16 '17 at 11:34
  • So how can I execute specific code when user changes textbox? – Rajesh Mhatre Jan 16 '17 at 12:12
  • Use a `DocumentListener`.. – Andrew Thompson Jan 16 '17 at 12:19
  • Thanks Andrew, This is the original query I have that I am not sure how and where to add listener code in Netbeans as most of the code is auto generated which can not be edited. Do you have any working code sample specific for netbeans IDE – Rajesh Mhatre Jan 16 '17 at 12:54
  • If this is not a duplicate, please edit your question to include a [mcve] that shows your revised approach. – trashgod Jan 16 '17 at 14:31

0 Answers0