I'd like to get my values in an array. Later I'd like to use the array in another class. How can this be done?
table.addMouseListener(new MouseAdapter() {
public void mouseClicked(MouseEvent e) {
if (e.getClickCount() == 1) {
JTable target = (JTable) e.getSource();
int row = target.getSelectedRow();
int column = target.getSelectedColumn();
row = table.convertRowIndexToModel(row);
String val1 = (String) table.getModel().getValueAt(row, 0);
String val2 = (String) table.getModel().getValueAt(row, 1);
String val3 = (String) table.getModel().getValueAt(row, 2);
String val4 = (String) table.getModel().getValueAt(row, 3);
String val5 = (String) table.getModel().getValueAt(row, 4);
System.out.println(val1 + " " + val2 + " " + val3 + " " + val4 + " " + val5);
}
}
});