Come faccio ad inserire lo scrollbar laterale nella tabella del seguente codice?
Grazie mille!




final JTable table = new JTable(data, columnNames);
JScrollPane scrollPane = new JScrollPane(table);
table.setFillsViewportHeight(true);
table.setEnabled(false);
j=new JTableHeader();
j=table.getTableHeader();
add(j);
j.setBounds(80, 80, 800, 30);
add(scrollPane);
scrollPane.setBounds(12, 110, 1000, 400);

table.setEnabled(true);


table.getSelectionModel().addListSelectionListener (

new ListSelectionListener() {
public void valueChanged(ListSelectionEvent event) {
sel=table.getSelectedRow();







int viewRow = table.getSelectedRow();
if (viewRow < 0) {



} else {
int modelRow =
table.convertRowIndexToModel(viewRow);

}
}
}
);