So, I was trying to look up values in a JTable, testing if what's in the x-line and y-column hits an object, but it's not going at all and I do not know why. I've tried everything = (
public Integer[] getRowIndex(Object value, int column) {
ArrayList<Integer> rows = new ArrayList<>();
for (int i = model.getRowCount(); i > 0; i--) {
if (table.getValueAt(i--, column).equals(value)) {
System.out.println("eai coldizera 2");
rows.add(i--);
}
}
return rows.toArray(new Integer[rows.size()]);
}
Resolved = D
public Integer[] getRowIndex(Object value, int column) {
ArrayList<Integer> rows = new ArrayList<>();
for (int i = 0; i < model.getRowCount(); i++) {
if (table.getValueAt(i, column).equals(value)) {
rows.add(i);
}
}
return rows.toArray(new Integer[rows.size()]);
}