• 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:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Swing JComboBox as CellEditor problem: always select non-existent empty value?

 
Ranch Hand
Posts: 31
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I have posted the same question here in StackOverFlow:

A detailed version of this question

In short, I am following the Oracle Tutorial to create a table with a column of JComboBox. I create the editor and renderer of this column as I read in the tutorial, more precisely, with these lines:



But, instead of seeing the imagen shown as follows:



which shows the first option at the first moment, I see my combobox in blank, like in the attachment.

I cannot figure out why. Selecting the first option is the default behavior, isn't it? Why I see a blank option coming from nowhere? I didn't set the , so why?



framn.PNG
[Thumbnail for framn.PNG]
 
Nope Torres
Ranch Hand
Posts: 31
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
What to address, is that all 3 options are there, but you have to click it to make them shown. Once selected, the combobox shows the value, it's ok, but upon the first rendering, it's blank.
 
Rancher
Posts: 3324
32
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Answered in the cross post.
 
Nope Torres
Ranch Hand
Posts: 31
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Rob Camick wrote:Answered in the cross post.



Thanks Camick, I have seen and answered your comments.

Now leaving alone the combobox/multichoice part, why the first item in the combobox is always blank, even it's a normal combobox?
 
Ranch Hand
Posts: 530
Hibernate Eclipse IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Nope Torres,

I've been playing around with JComboBox many times, so I compile a tutorial for JComboBox editor here. You may find it useful.
 
Rob Camick
Rancher
Posts: 3324
32
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

why the first item in the combobox is always blank



Already answered in the other posting.

You haven't yet "accepted" the answer to I guess you haven't read the updates.

This is why you should NOT be cross posting. You don't take the time to read all the information that has been given to you.
 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic