-2

I have a JTable implemented with a custom TableCellRenderer. The contents of the cell is a JList and I have created an inset around the list so that it does not abut the cell side. A fragment of the code is shown below:

    public PCSCellRenderer(){
    this.list = new JList();
     this.list.setBorder(BorderFactory.createEmptyBorder(10,10,10,10)); 
     ....

This works fine until I select an item on the list. At that time, the contents of cell shift left as if there is no EmptyBorder.

Is there any way to prevent this from happening?

Andrew Thompson
  • 168,117
  • 40
  • 217
  • 433
Elliott
  • 5,523
  • 10
  • 48
  • 87

1 Answers1

0

In this case there were two renderers. One when the cell was initialized and one when it was clicked on (edited). The formatting for these renderers was in conflict causing the result abov

Elliott
  • 5,523
  • 10
  • 48
  • 87