I have implemented ListSelectionListener as you can see below, so that after a specific line in the first table is being chosen, the second table gets updated accordingly.
class SelectionListener implements ListSelectionListener {
public SelectionListener(){}
@Override
public void valueChanged(ListSelectionEvent e)
{
if (e.getSource() == myTrumpsAndMessages.jTable1.getSelectionModel()
&& myTrumpsAndMessages.jTable1.getRowSelectionAllowed()
&& e.getValueIsAdjusting())
{
int selected = myTrumpsAndMessages.jTable1.getSelectedRow();
clearjTable(jTable4);
showSubscribers(selected);
}
}
}
Is there a way to invoke the listener not only when the mouse is choosing, but also when the choice is being made from the keyboard?
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…