wood burning stoves 2.0
The moose likes Swing / AWT / SWT and the fly likes how to work with Table Model? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "how to work with Table Model? " Watch "how to work with Table Model? " New topic

how to work with Table Model?

Yuta Lolap
Ranch Hand

Joined: Jun 03, 2012
Posts: 86

Hey guys,

Can anyone please explain with code how to work with Jtable in Netbeans using a tablemodel that appears by default when you add table component to your Jframe form.

I am facing issues retrieving data from the database into the dragged component.
Michael Dunn
Ranch Hand

Joined: Jun 09, 2003
Posts: 4632
I don't use netbeans, so this may not be exact.

from your description, generally you'd add this to your code

DefaultTableModel dtm;
dtm = (DefaultTableModel)table.getModel();
DefaultTableModel dtm = (DefaultTableModel)table.getModel();
//depends on required scope: class field, or local variable

in netbeans (I think) there's a call to an auto-generated initComponents()
called from a static(?) createAndShowGUI() (?)
if so, in createAndShowGUI(), it would go something like this

then you'd need to handle the static part
I agree. Here's the link: http://aspose.com/file-tools
subject: how to work with Table Model?
jQuery in Action, 3rd edition