Answer the question
In order to leave comments, you need to log in
How to display elements on JTable?
There is a code to display an array in a JTable, but an error occurs.
The JTable is created like this...
public static void setArrayJTable(JTable jTable){
for (int i = 1; i < jTable.getRowCount(); i++){
jTable.setValueAt("0 = ", i, 0);
}
for (int j = 2; j < jTable.getColumnCount(); j++){
jTable.setValueAt("-x" + (j - 1), 0, j);
jTable.setValueAt("1", 0, 1);
}
}
public static void setArrayJTable(Double[][] arrDouble){
for (int i = 0; i < Weight; i++){
for (int j = 0; j < Height; j++){
arrayJTableClass.jTable.setValueAt(String.valueOf(arrDouble[i][j]), i + 1, j + 1);
}
}
}
Answer the question
In order to leave comments, you need to log in
Here is a screenshot of that one. It should be. When displaying a matrix through this function, described above, the matrix is displayed either incompletely, or it gives an error that the elements were not found, this is if the code is slightly changed.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question