I’m using a JTable to show some data. The user can only select entire rows of the JTable, not individual cells. Here’s the code used to allow only rows selection:
jTable1.setCellSelectionEnabled(false);
jTable1.setColumnSelectionEnabled(false);
jTable1.setRowSelectionAllowed(true);
jTable1.setSelectionMode(javax.swing.ListSelectionModel.SINGLE_SELECTION);
But when a user selects a row the cell in that row gets outlined (first column / last row in the image below):

How Can I disable this outline?
You could simply extend the
DefaultTableCellRendererand pretend, from the UI’s side, that the cell isn’t “focused”.I removed the border by using the following renderer:
You can set it on your JTable like this:
or, for Strings:
It’s a bit of an hack in that it’s simply reusing the original renderer and pretending that the focused/selected cell isn’t but it should get you started.