• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Tim Cooke
  • Campbell Ritchie
  • Ron McLeod
  • Liutauras Vilda
  • Jeanne Boyarsky
Sheriffs:
  • Junilu Lacar
  • Rob Spoor
  • Paul Clapham
Saloon Keepers:
  • Tim Holloway
  • Tim Moores
  • Jesse Silverman
  • Stephan van Hulst
  • Carey Brown
Bartenders:
  • Al Hobbs
  • Piet Souris
  • Frits Walraven

setEditable(true) function of jcombobox not working

 
Ranch Hand
Posts: 62
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
hello everyone,

i am running a for loop for creating and populating comboboxes...i am also using the function setEditable(true) to make the comboboxes editable..however in the gui i am not able to edit the comboboxes.

for(i=0;i<5;i++)
{
///some code
cmb1_1[i].setEditable(true) //is not working.

//some code
}

could anyone kindly help me.


 
Ranch Hand
Posts: 118
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
hi. i think you should put your setEditable(true) before the loop.
and then if you wish to set it uneditable after populating your combobox, set it to false after your loop.
 
neha priya
Ranch Hand
Posts: 62
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
hi,
thanks for replying...but i can't use setEditable(true) before the for loop because the comboboxes are getting created in the loop...so if i try setting them before the loop it might give me NullPointerException...

THANKS.
 
Rancher
Posts: 3253
30
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Post your SSCCE demonstrating the problem.

And dont' forget to use the "Code tags" when posting the code.
 
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,

I am not sure why you are getting the problem but when i tried it, i was able to get the screen as required.

 
Sheriff
Posts: 22573
122
Eclipse IDE Spring VI Editor Chrome Java Windows
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Sriraman, please UseCodeTags. You can use the edit button to add them.
 
Sriraman Srinivasan
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
@Rob : Will surely take care of the code tags from next time. Thanks..
 
neha priya
Ranch Hand
Posts: 62
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
@Sriraman Srinivasan: thanks for replying...i wrote the same code yet am unable to edit the comboboxes...moreover i removed all the comboboxes and just placed a jtextfield and the problem is that am not able to edit the textfield area also.I am unable to guess why am not able to edit any component(be it combobox or textfield).


please help...
 
Sriraman Srinivasan
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
@neha: May be if you could provide a snippet of your code, may be we will be able to tell whats wrong with that....
 
neha priya
Ranch Hand
Posts: 62
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator




thanks for the reply....hey this is the code where am facing problem..
 
Sriraman Srinivasan
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
@neha:



The only thing here I see is that setenabled is redundent since by default all component are enabled. Apart from this I dont see any other issues. Not sure why your combo is not editable.
 
neha priya
Ranch Hand
Posts: 62
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
@Sriraman Srinivasan:thanks....i am too confused why its not working....even when i remove all the comboboxes and just place a JTextField then also am unable to edit the textfield....if i click in the textfield to write anything then the cursor stands like
capital "I"(I).....:-( :-(
 
reply
    Bookmark Topic Watch Topic
  • New Topic