aspose file tools*
The moose likes Swing / AWT / SWT and the fly likes how to know the status of a no-displayed-row in a filter working with JTable Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Java 8 in Action this week in the Java 8 forum!
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "how to know the status of a no-displayed-row in a filter working with JTable" Watch "how to know the status of a no-displayed-row in a filter working with JTable" New topic
Author

how to know the status of a no-displayed-row in a filter working with JTable

Ubaldo Robledo
Greenhorn

Joined: Dec 04, 2013
Posts: 22

Hey!

Im just starting to work with java. (actually programming as well). I have an Abstract table model on a Jtable with 3 filters.
i need to set a jlabel with the values of the total of the rows displayed on the table. also i have to set another Jlabel with the values of a sum of some values in a column.

the problem is when i set a filter the values doesn´t change. they remains as the same. so i need some help here.

thank you.


pepe pecas pica papas con un pico,
con un pico pepe pecas pica papas..
Rob Camick
Ranch Hand

Joined: Jun 13, 2009
Posts: 2097
    
    7
the problem is when i set a filter the values doesn´t change. they remains as the same. so i need some help here.


You need to get the data from the table instead of the model. That is instead of using:

table.getModel().getValueAt(...);

you should use:

table.getValue();

Now your looping code will only get data from the visible rows in the table.
Ubaldo Robledo
Greenhorn

Joined: Dec 04, 2013
Posts: 22

thank you, I never thought that it where simply as that, the importance of knowing your controls.

well. thank you again Rob
(sorry for my bad english)
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: how to know the status of a no-displayed-row in a filter working with JTable
 
Similar Threads
JTable problem
JTable
JComboBox in a JTable
JTable
Row Selection problems with JTable