I have a JTable
with contents on it which I have read from a CSV file. I am using the following method which when I click on a row it will open up a new JFrame
and close the previous one. It will display things such as ID, co-ordinates, status of what is written on that table and can edit them if wanted. E.G. table below:
|ID |co-ordinates | status |
| 1 | (3,21) | pending |
| 2 | (4,21) | full |
| 3 | (9, 12) | empty |
If I click row 1, it will pop up with frame of the ID(1), co ordinates(3,21) and status in a text field in another frame and is editable. I am able to do the clicking function but am not sure how to take that data onto the next frame when clicking the row.
//in location class
table.addMouseListener(new MouseAdapter() {
public void mouseClicked(MouseEvent e) {
if (e.getClickCount() == 1) {
int row = table.getSelectedRow();
AddEdit An = new AddEdit(); //goes to next class
An.setVisible(true);
dispose();
}
}
});
How to take that data onto the next frame, when clicking the row?