Win a copy of Murach's Python Programming this week in the Jython/Python forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

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

 
Nope Torres
Greenhorn
Posts: 24
  • Mark post as helpful
  • send pies
  • 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
Greenhorn
Posts: 24
  • Mark post as helpful
  • send pies
  • 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.
 
Rob Camick
Ranch Hand
Posts: 2754
12
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Answered in the cross post.
 
Nope Torres
Greenhorn
Posts: 24
  • Mark post as helpful
  • send pies
  • 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?
 
Nam Ha Minh
Ranch Hand
Posts: 512
Eclipse IDE Firefox Browser Windows
  • Mark post as helpful
  • send pies
  • 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
Ranch Hand
Posts: 2754
12
  • Mark post as helpful
  • send pies
  • 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.
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!