NetBeans Forums

 FAQFAQ   SearchSearch   MemberlistMemberlist   RegisterRegister   ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 
  

ComboBox + Listeners = Confused

 
Post new topic   Reply to topic    NetBeans Forums -> Java EE Users
View previous topic :: View next topic  
Author Message
CharlesCVA



Joined: 23 Mar 2011
Posts: 20

PostPosted: Thu Apr 21, 2011 4:13 pm    Post subject: ComboBox + Listeners = Confused Reply with quote

I have a ComboBox that is Editable. This allows user to select existing values, or type their own. The idea is that as you type a regular expression into the Combobox... A preview of the text your regular expression is capturing is displayed for you on the fly.

I was able to do this with KeyListener. HOWEVER....When the selected index is programmatically changed my KeyListener is not fired, and the update does not happen.

If user selects value from list, it is okay because i can catch that with ActionListener. But this means that with KeyListener... i will have to have more than one type of listener doing the same job!

I was hoping to use PropertyChangeListener to "monitor" the text in the ComboBox.... perhaps the ComboBox.getEditor() component should have a PropertyChangeListener???

I would like to use just one listener for this task. if this doesn't make sense, please ask and i will try to clarify further.

Please advise.

THANKS IN ADVANCED,

CHARLES



screenshot_196.png
 Description:
Grey area is where regular expression results would appear if i could find just one listener to cover the text of combobox.
 Filesize:  149.34 KB
 Viewed:  814 Time(s)

screenshot_196.png


Back to top
Display posts from previous:   
Post new topic   Reply to topic    NetBeans Forums -> Java EE Users All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You can attach files in this forum
You can download files in this forum


Powered by phpBB
By use of this website, you agree to the NetBeans Policies and Terms of Use. © 2012, Oracle Corporation and/or its affiliates. Sponsored by Oracle logo