JButton actionButton,
JButton cancelTaskButton,
JButton addInstanceButton,
JButton viewDataButton) {
setLayout(new BorderLayout(10, 10));
TableSorter sorter = new TableSorter(worklistModel); //ADDED THIS
_myTable = new JTable(sorter);
_myTable.setPreferredScrollableViewportSize(size);
_myTable.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
worklistModel.addRow("InstanceValidator", new String[]{"", "", "", "", "", ""});
synchronized (_myTable) {
_myTable.setModel(worklistModel);
_myTable.getColumnModel().getColumn(0).setPreferredWidth(45);
_myTable.getColumnModel().getColumn(1).setPreferredWidth(45);
_myTable.getColumnModel().getColumn(2).setPreferredWidth(250);
_myTable.getColumnModel().getColumn(3).setPreferredWidth(100);
_myTable.getColumnModel().getColumn(4).setPreferredWidth(100);
_myTable.getColumnModel().getColumn(5).setPreferredWidth(100);
}
worklistModel.removeRow("InstanceValidator");
sorter.addMouseListenerToHeaderInTable(_myTable); //ADDED THIS
// Place table in JScrollPane
JScrollPane scrollPane = new JScrollPane(_myTable);
scrollPane.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_ALWAYS);
// Add to Screen
add(scrollPane, BorderLayout.CENTER);