Junior Software Engineer, Senior appearance
Maneesh Godbole wrote:T
One point to note here is AbstractTableModel returns false where as the default implementation DefaultTableModel returns true! You need to check which model you are using.
Junior Software Engineer, Senior appearance
Daan Heuvelbeuk wrote:
Alas, I extend the DefaultTableModel.
Maneesh Godbole wrote:
Daan Heuvelbeuk wrote:
Alas, I extend the DefaultTableModel.
Huh? That means your table is editable.
Junior Software Engineer, Senior appearance
Daan Heuvelbeuk wrote:
And although I was clicking in the cell I wanted to change, I could not change it.
Maneesh Godbole wrote:
Ah! But you need to click twice.
Junior Software Engineer, Senior appearance
Junior Software Engineer, Senior appearance
Daan Heuvelbeuk wrote:
So what causes the error?
Maneesh Godbole wrote:
1) What class object does DateFormat.format(date); return?
2) Are you returning the correct class in getColumnClass(int col)
Junior Software Engineer, Senior appearance
Rob Camick wrote:Table Format Renderer shows how you can create a simple renderer.
<SNIP>
If you don't like the way the date is presented in the editor, then you will need to provide a custom editor. Read the Swing tutorial on Editors and Renderers.
Junior Software Engineer, Senior appearance
Junior Software Engineer, Senior appearance
Rob Camick wrote:Here is the code used to create the image found in the blog link I provided you with showing how to use the custom renderers.
Junior Software Engineer, Senior appearance
Junior Software Engineer, Senior appearance
Rob Camick wrote:You haven't posted your SSCCE demonstrating the problem, so we can't help.
Junior Software Engineer, Senior appearance
Rob Camick wrote:You are using an SQL Date, which won't work.
The default editor needs to be able to take the String entered in the text field and create a new instance of the Object. SQL Date does not support the date format displayed in the editor.
That is why I stated that if you don't like the way a Date is displayed in the editor, then you need to create a custom editor. I gave you a link to the JTable tutorial.
If you want the date to be displayed as YYYY-MM-DD then your custom editor needs to take a String of that format and then convert it to a Date object to be stored in the model.
Junior Software Engineer, Senior appearance
The first person to drink cow's milk. That started off as a dare from this tiny ad:
New web page for Paul's Rocket Mass Heaters movies
https://coderanch.com/t/785239/web-page-Paul-Rocket-Mass
|