I'm making database application and I'm strugling with this problem for a week. I'm also not sure how to post title to my question, but I hope you will understand. I have two frame's: City and Country.
City frame:
Country frame:
When I click on "Search" button in City frame it opens me a Country frame. And when I click on table in Country frame it passes value from selected row and column "Country" into a variable tableValCountry by this method:
table.addMouseListener(new MouseListener(){
@Override
public void mouseClicked(MouseEvent e) {
int selRow = table.getSelectedRow();
String tableValCountry = (String)table.getValueAt(selRow, 1);
}
@Override
public void mouseEntered(MouseEvent e) {
}
@Override
public void mouseExited(MouseEvent e) {
}
@Override
public void mousePressed(MouseEvent e) {
}
@Override
public void mouseReleased(MouseEvent e) {
}});
Then I want to pass that tableValCountry variable to City frame and update one of textfield's by clicking add button. How can I achieve that? Thanks in advance.
P.S. I could do that with getters and setters but I would need to have some "fetch" button in my City frame to retrieve value (which I don't want to do). And also City frame must be visible all time.