I’m having issue with Action Listener of a JTable that being updated according the radioButtons.
I created a blank table and just re-update according to which button is selected.
The only issue I have is that the action Listener are not being updated along with the current table.
For example
Table A
Table B
Table C (only one with action listeners)
If I click through A B it’s fine but once I hit C and try going back to A and selecting a row it still performing the action listeners of Table C. Is there a way to remove the action Listeners from a JTable?
Code Looks something along this line
JTable table = new JTable();
//Inside buttonActionListener
if (A)
table.setmodel(A);
else if (B)
table.setmodel(B);
else if (C)
{
table.setmodel(C);
table.addmouselistener(new mouseclick())
}
I could just add action listener to all of the table…which defeats the point of me updating them … but yea is there a way around this?
Just use
But something is weird if you need to add and remove listeners all the time… Maybe you’d better have the listener remain but write it so that it checks some kind of condition that verifies its logic should be preformed.