Merge pull request #1388 from SiboVG/issue-1286
[#1286] Use table row selection listener to update sim button state
This commit is contained in:
commit
5c358ab222
@ -35,6 +35,8 @@ import javax.swing.JTable;
|
|||||||
import javax.swing.KeyStroke;
|
import javax.swing.KeyStroke;
|
||||||
import javax.swing.ListSelectionModel;
|
import javax.swing.ListSelectionModel;
|
||||||
import javax.swing.SwingUtilities;
|
import javax.swing.SwingUtilities;
|
||||||
|
import javax.swing.event.ListSelectionEvent;
|
||||||
|
import javax.swing.event.ListSelectionListener;
|
||||||
import javax.swing.table.DefaultTableCellRenderer;
|
import javax.swing.table.DefaultTableCellRenderer;
|
||||||
import javax.swing.text.DefaultEditorKit;
|
import javax.swing.text.DefaultEditorKit;
|
||||||
|
|
||||||
@ -565,8 +567,16 @@ public class SimulationPanel extends JPanel {
|
|||||||
}
|
}
|
||||||
} else if (e.getButton() == MouseEvent.BUTTON3 && e.getClickCount() == 1){
|
} else if (e.getButton() == MouseEvent.BUTTON3 && e.getClickCount() == 1){
|
||||||
doPopup(e);
|
doPopup(e);
|
||||||
} else {
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
simulationTable.getSelectionModel().addListSelectionListener(new ListSelectionListener() {
|
||||||
|
private int previousRow = -1;
|
||||||
|
public void valueChanged(ListSelectionEvent event) {
|
||||||
|
if (simulationTable.getSelectedRow() != previousRow) {
|
||||||
updateButtonStates();
|
updateButtonStates();
|
||||||
|
previousRow = simulationTable.getSelectedRow();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
Loading…
x
Reference in New Issue
Block a user