• 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
  • Tim Cooke
  • Ron McLeod
  • paul wheaton
  • Jeanne Boyarsky
Sheriffs:
  • Paul Clapham
  • Devaka Cooray
Saloon Keepers:
  • Tim Holloway
  • Roland Mueller
  • Himai Minh
Bartenders:

tablecelleditor doesn't call setvalueat

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

Hi There,

I use comboboxes within my JTable. If I use the DefaultCellEditor, it calls the setValueAt() method of my TableModel perfectly so that I can change the content of my model.

However, if I use my custom TableCellEditor, it doesn't call the setValueAt() method.

Any idea how I can "convince" my TableCellEditor to call setValueAt() when its value changes ?

Thanks in advance,

Ulvi
 
Bartender
Posts: 1561
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
It's hard to know what you're doing wrong without code. You may wish to create a Short, Self Contained, Correct (Compilable), Example or SSCCE. This is a small program that compiles, runs, demonstrates your problem, and contains no extraneous code. Please read the link, and have a go at it. Creating an SSCCE actually serves two purposes, the most obvious being that you can post a short program that we can inspect and run, and help you solve your problem, but the better purpose is that often when you go through this process and are required to isolate your problem and inspect it in all its nakedness, you will experience an "aha" moment and will be able to solve the problem yourself. Best of luck.
 
Author
Posts: 986
3
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

ulvi ugur wrote:
Any idea how I can "convince" my TableCellEditor to call setValueAt() when its value changes ?



And just for the record, the cell editor doesn't actually call setValueAt(). What essentially happens is that JTable does this:

Object value = theCellEditor.getCellEditorValue();
setValueAt(value, theRow, theColumn);
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic