0
So I was trying to look for values in a Jtable, testing if what’s on the x line and the y column matches an object, but it’s not going at all and I don’t 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()]);
}
Solved =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()]);
}
Your question has already been answered in the two that Linkei, one deals calmly in the answers.
– user28595
I was able to solve =D
– Pedro