🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Thread View: borland.public.jbuilder.java.swing
2 messages
2 total messages Started by George Tue, 28 Oct 2003 21:43
displaying dates in JTable cells
#1544
Author: George
Date: Tue, 28 Oct 2003 21:43
14 lines
1518 bytes
I am trying to display a result set from an Oracle database in a JTable.
The isCellEditable() method returns true for all cells in this table.

I find that the cells are editable if the column type in the database is
varchar2 and number data types,  If the column type is java.sql.Date, the
cell is not editable.
 If however I create java.util.Date objects within the program, the table
cells are editable for these objects.

Why is this so?  I am now working around this by converting the date
information to String before displaying in the table.  But I would prefer a
more elegant method, if someone can show me.

Thanks
Re: displaying dates in JTable cells
#1417
Author: John McGrath [TeamB]
Date: Sat, 08 Nov 2003 09:41
28 lines
1907 bytes
On 10/28/2003 at 4:43:13 PM, George wrote:

> I am trying to display a result set from an Oracle database in a
> JTable.  The isCellEditable() method returns true for all cells in
> this table.
> 
> I find that the cells are editable if the column type in the database
> is varchar2 and number data types,  If the column type is
> java.sql.Date, the cell is not editable.
>  If however I create java.util.Date objects within the program, the
> table cells are editable for these objects.
> 
> Why is this so?  

The default editor lookup mechanism requires an exact match on the
class - it will not find an editor for a subclass.  What you need to do
is to define the default editor for the java.sql.Date class.  I think
you should be able to get the default editor for the java.util.Date
class and use that.

-- 
Regards,

John McGrath [TeamB]

---------------------------------------------------
Before sending me e-mail, please read:
    http://www.JPMcGrath.net/newsgroups/e-mail.html
Thread Navigation

This is a paginated view of messages in the thread with full content displayed inline.

Messages are displayed in chronological order, with the original post highlighted in green.

Use pagination controls to navigate through all messages in large threads.

Back to All Threads