0

I have tried putting rows in a JTable and that is what I managed to do. My variable input stores text from a textfield. What I want is that if an input is repeated, the word appears in one column and in the other column the times that it has been repeated. "1" there must be the word count. I know that the "1" there is just always printing "1" in the row. I want that number to increase when the word is repeated.

model.insertRow(model.getRowCount(), new Object[]{"1",input});
Sebastian
  • 3
  • 1
  • Instead inserting a new row each time, use `model.setValueAt(yourIncreasedValue, row, column)` to set a value in specific cell. – pafau k. May 31 '20 at 16:44
  • how can I find the row in which I have the repeated value? – Sebastian May 31 '20 at 16:58
  • Well, you have used `model.getRowCount()` to get number of rows, so just go from zero to that, and use `model.getValueAt` to see what's in there. – pafau k. May 31 '20 at 17:58

0 Answers0