Win a copy of Cross-Platform Desktop Applications: Using Node, Electron, and NW.js this week in the JavaScript forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Editable JComboBox Poblem  RSS feed

 
Kinu Kanwar
Ranch Hand
Posts: 33
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
My combo box is editable , There are many tex tfields etc on screen

On clicking search button, how could I know what user has typed.

For non editable , following code works but for editable if user has written some thing and click search , it does not get any thing.

String str = (String) cb_level1.getSelectedString();
if ( (str != null ) && ! ( str.trim().equals("") ))
return true ;

Any help is appreciated.

Kinu
 
Gregg Bolinger
Ranch Hand
Posts: 15304
6
Chrome IntelliJ IDE Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I see no getSelectedString() method for a JComboBox. If I use getSelectedValue() then I get the selection or whatever I have typed into the editable box. What is cb_level1?
 
Consider Paul's rocket mass heater.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!