JComboBox & JTable connecting to database

Hi

I have two problems

1. When i get data in JTable from database, all is fine except one thing dat shown in Date colimn is like 2007-06-19 00.00.00 while it like 19/06/2007 in database. Any solution to this.

2. I used the same Vector to populate the for both JTable and JComboBox, i used like this:

JComboBox cmb =new JComboBox(Vector rowData);

it shows the data but like this:

[eye]

[Lab]

[Out Door]

but in data base it is like

eye

Lab

Out Door

why it showing [ ] while in JTable it is all right.

I am using Access as the database, maybe thats the problem?

Thanks

[664 byte] By [jawadaha] at [2007-11-27 8:16:31]
# 1

1) The default renderer for the table simply uses the toString() method of the Object when displaying the data. If your table stores a Date Object in the TableModel then you need to tell the data this so it can choose a Date renderer to format the data. You do this by overriding the getColumnClass() method of JTable or the TableModel. Read the Swing tutorial on "How to Use Tables" http://java.sun.com/docs/books/tutorial/uiswing/components/table.html for more information or search the forum for examples.

2) Don't know I would need a demo program that shows the problem.

If you need further help then you need to create a "Short, Self Contained, Compilable and Executable, Example Program (SSCCE)", see http://homepage1.nifty.com/algafield/sscce.html, that demonstrates the incorrect behaviour, because I can't guess exactly what you are doing based on the information provided.

Don't forget to use the "Code Formatting Tags", see http://forum.java.sun.com/help.jspa?sec=formatting, so the posted code retains its original formatting.

camickra at 2007-7-12 20:01:25 > top of Java-index,Desktop,Core GUI APIs...