JTable table = new JTable(data, columns); table.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
JTable table = new JTable(data, columns); table.setSelectionMode(ListSelectionModel.MULTIPLE_INTERVAL_SELECTION);
JTable table = new JTable(data, columns); table.setSelectionMode(ListSelectionModel.SINGLE_SELECTION); table.setRowSelectionAllowed(false); table.setColumnSelectionAllowed(false);In this example, the JTable is set to not allow any rows or columns to be selected. This is useful when the table is used for display purposes only and should not allow any user interaction.