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);

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

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

  • 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

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.