1. getValueAt in JTable coderanch.comMark, I don't know if this helps you any, but here is some of my code. ResultModel rm = new ResultsModel(); public class LSL implements ListSelectionListener { public void valueChanged(ListSelectionEvent lse) { getSelectedValue(); } } public void getSelectedValue() { i = table.getSelectedRow(); addrID.setText((String)rm.getValueAt(i,1)); nameField = (String)rm.getValueAt(i,2); add1Field = (String)rm.getValueAt(i,3); add2Field = (String)rm.getValueAt(i,4); cityField = (String)rm.getValueAt(i,5); stateField = (String)rm.getValueAt(i,6); zipField = (String)rm.getValueAt(i,7); ... |
2. JTable and getValueAt() coderanch.comHello, I am experimenting with the getValuAt() method. When I use the following: array[i][j] = table.getValueAt(i, j); object = array[i][j]; System.out.println("value of array is: " + array[i][j]); System.out.println("value of object is: " + object); ... I get what I expect... Row2-Column1 ...ect. However, when I save to file using: fOut = new FileOutputStream(filePath); oOs = new ObjectOutputStream(fOut); ... and then read ... |
3. ArrayIndexOutOfBounds, JTable.getValueAt java-forums.orgPerfect example of the problem. Code should print out "valid" and the contents of the first column, same row cell if the selected cell is in the second column, and "invalid" and the contents of the first column, same row cell if the selected cell is in the first. Instead, the first two clicks throw errors. The code is a bit ... |