File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Swing / AWT / SWT and the fly likes HELP on JTABLE and table model Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "HELP on JTABLE and table model" Watch "HELP on JTABLE and table model" New topic
Author

HELP on JTABLE and table model

joseph dela cruz
Ranch Hand

Joined: May 17, 2012
Posts: 38

i need help on clearing tables guys
i want to clear the tables then get all the elements from JDBC again just like what it does on form load the problem is when i clear it which i did. but whenever i call the upTable it loads 6 columns instead of just three

this method is triggered by a button
also please comment on the way i put rows is it proper to use a constructor object or a different way is way much better?
Rob Spoor
Sheriff

Joined: Oct 27, 2005
Posts: 19541
    
  16

Removing a column from your JTable does not remove the column from your TableModel, only from the visual representation.
Assuming you're using a DefaultTableModel, you can clear that with just two lines:

joseph dela cruz wrote:also please comment on the way i put rows is it proper to use a constructor object or a different way is way much better?

Since you create the object, get its values, then discard it, I would skip it completely:


SCJP 1.4 - SCJP 6 - SCWCD 5 - OCEEJBD 6
How To Ask Questions How To Answer Questions
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: HELP on JTABLE and table model
 
Similar Threads
how to improve my program code ?
Problem in inserting from one table to another
Mysql conncections won't close, please help!!
Spring 101: DB Table to return a Map of Code,Description.
How to put a list of data retrieve from database into arraylist