Different Cell Editors in same COLUMN of a JTable

Hi all,
  I'm trying to use JTable slightly unconventionally.
  In this case, the JTable is to be used to display only one record at a time, and therefore I'll only allow the user to make changes to one record at a time.
  A JTable with one row don't look very nice, so instead I'm made that row into a column. So right now I have 2 columns: the 1st column are the headers, while the 2nd are the editable values of the corresponding header (ie values column). If you have familiar with the object inspector in JBuilder or VB RAD environment, you'll know what I mean.
  Now I'm trying to make my cell editor for my values column to change according to the row that was selected.
Therefore, for example, if the user selects the "Name" row, I'll display a ordinary jtextfield cell editor, while in the "Nationality" row, I'll display a jcombobox cell editor.

  The problem for me arises when I try to switch from a jcombobox row to a jtextfield row. I used the listselectionmodel to detect a change in the row selection, and then switch the cell editor in the event handler. But it doesn't work, my jcombobox appears in the jtextfield row, carrying the jcombobx values there and overwriting it. Apparently, that was done even before my event handler was executed.

Is there a way around this?
jernhungAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

vivexpCommented:
Hi,


Visit http://www2.gol.com/users/tame/swing/examples/JTableExamples2.html
the examples here might solve ur problem, If i have understood it correctly!!


Best of Luck
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
jernhungAuthor Commented:
Wow!

That was a great site!

I didn't know JTable was that powerful!

Thanks for your help. That site will go into my bookmark.

A bonus 25 points!
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Java

From novice to tech pro — start learning today.