This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.

Bug 249687 - JTable doesn't include date type
Summary: JTable doesn't include date type
Status: NEW
Alias: None
Product: guibuilder
Classification: Unclassified
Component: Code (show other bugs)
Version: 8.0.2
Hardware: PC Linux
: P3 normal (vote)
Assignee: issues@guibuilder
URL:
Keywords:
: 249686 (view as bug list)
Depends on:
Blocks:
 
Reported: 2015-01-08 08:42 UTC by ilantal
Modified: 2015-09-11 14:00 UTC (History)
0 users

See Also:
Issue Type: ENHANCEMENT
Exception Reporter:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description ilantal 2015-01-08 08:42:07 UTC
The Java documentation says

To choose the renderer that displays the cells in a column, a table first determines whether you specified a renderer for that particular column. If you did not, then the table invokes the table model's getColumnClass method, which gets the data type of the column's cells. Next, the table compares the column's data type with a list of data types for which cell renderers are registered. This list is initialized by the table, but you can add to it or change it. Currently, tables put the following types of data in the list:

    Boolean — rendered with a check box.
    Number — rendered by a right-aligned label.
    Double, Float — same as Number, but the object-to-text translation is performed by a NumberFormat instance (using the default number format for the current locale).
    Date — rendered by a label, with the object-to-text translation performed by a DateFormat instance (using a short style for the date and time).
    ImageIcon, Icon — rendered by a centered label.
    Object — rendered by a label that displays the object's string value.

If I use the Design panel for JTable the list includes Object, String several number formats, but there is no Date.
It looks like a fairly easy fix to add it.

As a work around I did a copy-paste of the automatic code generated by the design editor and hand modified the code for my column to java.util.Date.class. That solved my problem. I would however prefer that Netbeans include the Date in the list so it is in line with the Java documentation.

I may have placed this bug in the wrong category. If so, please correct it for me. I must say that Netbeans is a truely superb piece of software. I refuse to use anything else. So, if it is easy to fix, please update the list to fit the Java documentation.

Thanks,
Ilan
Comment 1 Jiri Prox 2015-01-08 10:37:31 UTC
*** Bug 249686 has been marked as a duplicate of this bug. ***
Comment 2 Tomas Pavek 2015-09-11 14:00:24 UTC
Yes, would be nice if the simple table customizer also supported Date.