Win a copy of Re-engineering Legacy Software this week in the Refactoring forum
or Docker in Action in the Cloud/Virtualization forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

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

 
Ubaldo Robledo
Greenhorn
Posts: 22
Java MySQL Database Netbeans IDE
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Rob Camick
Ranch Hand
Posts: 2539
9
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 22
Java MySQL Database Netbeans IDE
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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)
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic