-1

Possible Duplicate:
How to display first row until last row to JR report using Java?

i want to call the record in table from first row until last row and display it ..

i used this syntax :

TableModelEvent tab = new TableModelEvent(view.getTable().getModel());
int first = tab.getFirstRow();
int last = tab.getLastRow();
for(int a = first;a<last;a++){
  JTable tables = new JTable(view.getTable().getModel());
  if(tables.getColumnName(3).equals("Price")){
    BigDecimal price = (((BigDecimal)view.getTable().getModel().getValueAt(a,3)));

but it just display the data from last row, so what to do to display data from first row until lastrow ?

Community
  • 1
  • 1
  • 1
    Consider posting an [SSCCE](http://sscce.org) to get valuable help. Without context, your snippet does not make much sense and it is hard to understand what you're trying to do and what the problem is. – Guillaume Polet Sep 05 '12 at 09:33

1 Answers1

1
mKorbel
  • 109,525
  • 20
  • 134
  • 319
  • @Deni: There's no need to construct a `TableModelEvent`; you can traverse the `TableModel`, as shown in this related [example](http://stackoverflow.com/a/12246000/230513). – trashgod Sep 05 '12 at 11:14