I have a GUI that has multiple tables each in its own tab. Each table is configured to only allow single selections and to clear its selection when another tab is clicked. I have a delete button that deletes a selected row. I tried using isVisible() to determine which table was being displayed but it seems to regard all tables as visible. I need a way to find out which table either has a selected row, or which table is visible to the user (as in which tab is open).
Here is an example of my incorrect method:
if(jtblSunLessons.isVisible()){
Day = "Sunday";
startTime = jtblSunLessons.getValueAt(jtblSunLessons.getSelectedRow(), 0).toString();
}
else if(jtblMonLessons.isVisible()){
Day = "Monday";
startTime = jtblMonLessons.getValueAt(jtblMonLessons.getSelectedRow(), 0).toString();
}
else if(jtblTuesLessons.isVisible()){
Day = "Tuesday";
startTime = jtblTuesLessons.getValueAt(jtblTuesLessons.getSelectedRow(), 0).toString();
}
Column 0 is the starting time of a lesson. Day and startTime are strings. Thanks!