Start New Discussion within our Software Development Community

Howdy-ho.

I am trying to right click on my table and change the cell border color and highlight color of that cell.

I have figure out how to give that particular cell focus when I right click it by using

int row = fixed.rowAtPoint(evt.getPoint());
int col = fixed.columnAtPoint(evt.getPoint());

fixed.changeSelection(row, col, false, false);
fixed.requestFocus();

However when I want to visual distinguish a right click from any other click.

Usually a cell with focus looks like this: with the blue thick border around the selected cell, as well as the blue background around everything in that row
e6ef5c487a6756ad3c6856868a02f596

How do I change the focus border of just that cell, and also change the row highlighhted color when I RIGHT click please?

Attachments cell_border.png 2.06 KB
  • use parameter for override isSelected/hasFocus (not clear from your description) in XxxTableCellRenderer/prepareRenderer

  • renderer has (bug or feature) memory issue, in most cases have to reset useless painting in another cells

  • JTable has setting for row, column and cell selection in API

This question has already been answered. Start a new discussion instead.