mcmahling
asked on
Adding a TableModel to an exisitng JTable at runtime
I am using NetBeans 6.1 for Mac to create a desktop application. I want to query a database and use an attached resultset to create a tablemodel that will be eventually used to fill a JTable that I created at runtime. I am new to java and can not find a way to attach a tablemodel to a jtable at runtime. Can anyone suggest some code?
ASKER CERTIFIED SOLUTION
membership
Create a free account to see this answer
Signing up is free and takes 30 seconds. No credit card required.
check this example to create your own table model and set to table,
https://java.sun.com/docs/books/tutorial/uiswing/components/table.html#data
https://java.sun.com/docs/books/tutorial/uiswing/components/table.html#data
Netbeans will build automagically the JTable connected to the database with buttons for adding, editing, removing, committing and rollbacking ;)