Re: JTable display



In article
<102e154f-829f-46e5-a533-fd0c2c6de19f@xxxxxxxxxxxxxxxxxxxxxxxxxxxx>,
Abbas <a.mohamed.abbas.ali@xxxxxxxxx> wrote:

In the below code I'm trying to display two fields (String and Date),
what happens is I'm not able to get the desired display of date in the
JTable. Can any one help me in getting the date displayed like "H:m |
dd-MM-yyyy"?

Thanks,
Abbas
[...]
public JTable mainTable = new JTable();
public DefaultTableModel defaultTableModel = new DefaultTableModel(){
public Class getColumnClass(int c){
return getValueAt(0,c).getClass();
}
};
[...]

Your implementation of getColumnClass() is incorrect. The default
implementation provided by AbstractTableModel does what you want:

public DefaultTableModel defaultTableModel = new DefaultTableModel();

John
--
John B. Matthews
trashgod at gmail dot com
home dot woh dot rr dot com slash jbmatthews
.