• Post Reply Bookmark Topic Watch Topic
  • New Topic

jtable like excel with jdbc

 
Manuel Jordan
Ranch Hand
Posts: 131
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hello guys

after to read
http://java.sun.com/docs/books/tutorial/jdbc/

i need to learn how to work with jdbc and jtable like excel,

it means each row must be dynamic, columns of the row must be editable and must update the db

so the question,
which is the best book to learn this?
and best links of your preference guys

thanks in advanced
 
Ulf Dittmer
Rancher
Posts: 42970
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
JTable can do what you describe on the client, and you can certainly use JDBC to save any changes to the DB. What problems exactly are you facing implementing this?
 
Manuel Jordan
Ranch Hand
Posts: 131
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Ulf

thanks for the reply

What problems exactly are you facing implementing this?

well i am not an expert yet about JTable, a nice tutorial with advanced features about this , well i need it

regards
 
Rob Spoor
Sheriff
Posts: 20822
68
Chrome Eclipse IDE Java Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The hardest work here is not with the JTable but its TableModel.

Basically you should create your own implementation of TableModel. Most of the values you can get directly from the ResultSet and its ResultSetMetaData, such as the number of columns, the names of the columns, the classes of the columns and whether or not a cell is editable (although RSMD checks if a columns is read-only, so the other way around).

The hardest methods will be getRowCount(), getValueAt() and setValueAt().
Please note that you probably need your result set to be able to move forward and backward as needed.
 
Ulf Dittmer
Rancher
Posts: 42970
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The Sun Java Tutorial has an extensive section on JTable, table models, table cell renderers and all the rest. That should be sufficient to get you started.
 
Manuel Jordan
Ranch Hand
Posts: 131
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello guys

thanks for the replies and sorry by my delay response

Rob
Basically you should create your own implementation of TableModel

can you share or suggest a nice link or a book (i prefer a book) about this topic?, your experience is appreciate

Most of the values you can get directly from the ResultSet and its ResultSetMetaData,

same case

Ulf
The Sun Java Tutorial has an extensive section on JTable, table models, table cell renderers and all the rest. That should be sufficient to get you started.

thanks for the link, but after of that, is there something more advanced??

thanks in advanced
 
Ulf Dittmer
Rancher
Posts: 42970
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Manuel Jordan:
thanks for the link, but after of that, is there something more advanced?

I don't think there's much more to be learned about JTables than what's covered by that chapter. It's certainly enough to accomplish what you described.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!