Win a copy of Practical SVG this week in the HTML/CSS/JavaScript forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

tablecelleditor doesn't call setvalueat

 
ulvi ugur
Ranch Hand
Posts: 48
  • Mark post as helpful
  • send pies
  • 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
 
pete stein
Bartender
Posts: 1561
  • Mark post as helpful
  • send pies
  • 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.
 
Brian Cole
Author
Ranch Hand
Posts: 924
1
  • Mark post as helpful
  • send pies
  • 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);
 
Paper has not yet been outlawed – so let your Java Swing application print with wild abandon: JPDF
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!