It's not a secret anymore!
The moose likes Swing / AWT / SWT and the fly likes Retrieving DefaultTableModel from JTable Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of REST with Spring (video course) this week in the Spring forum!
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "Retrieving DefaultTableModel from JTable" Watch "Retrieving DefaultTableModel from JTable" New topic

Retrieving DefaultTableModel from JTable

Hewa Naimanage Sumedha Amalka

Joined: Oct 31, 2006
Posts: 19
Hi guys, I need to get DefaultTableModel from my exsiting Jtable; I am using Java 5.0 and when I use

DefaultTableModel model = (DefaultTableModel)dataTable.getModel();

sends me a

SCJP 1.4 71%, SCWCD 1.5 84%, SCBCD 90%, SCMAD 98%
Darryl Burke

Joined: May 03, 2008
Posts: 5093

If you need the table to have a DefaultTableModel, either construct it with a DefaultTableModel or setModel to a DefaultTableModel.

If the table's model isn't a DefaultTableModel, you can't cast it as such.

luck, db
There are no new questions, but there may be new answers.
I agree. Here's the link:
subject: Retrieving DefaultTableModel from JTable
It's not a secret anymore!