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?