Vision Power Table - Add columns border with configureEditor()

Hey!
I'm trying to make this kind of border style:

I'm trying to use the configureEditor event, but I can't find any documentation explaining how to configure the border parameter.

In fact, I couldn't even make this event run, I put a print and it never appears on the console.

Any tips on how I could do this?
Thank you very much

I imagine that this will need to be done in the configureCell extension function instead of the configureEditor. You will probably need to import border factory or something similar and return the border property of each cell of each column based on whether they are the first row, last row, or middle rows

2 Likes

I found a few moments this morning to adapt the above suggestion into my test table.

Here is the sample code:
def configureCell([...]):
	from javax.swing import BorderFactory
	from java.awt import Color
	if rowIndex == 0 and colIndex == 0:
		border = BorderFactory.createMatteBorder(8, 8, 1, 4, Color(255, 255, 255))
	elif rowIndex == (self.data.rowCount-1) and colIndex == 0:
		border = BorderFactory.createMatteBorder(1, 8, 8, 4, Color(255, 255, 255))
	elif rowIndex == 0 and colIndex == (self.data.columnCount-1):
		border = BorderFactory.createMatteBorder(8, 4, 1, 8, Color(255, 255, 255))
	elif rowIndex == (self.data.rowCount-1) and colIndex == (self.data.columnCount-1):
		border = BorderFactory.createMatteBorder(1, 4, 8, 8, Color(255, 255, 255))		
	elif rowIndex == (self.data.rowCount-1) and colIndex == 0:
		border = BorderFactory.createMatteBorder(1, 8, 8, 4, Color(255, 255, 255))
	elif rowIndex == 0:
		border = BorderFactory.createMatteBorder(8, 4, 1, 4, Color(255, 255, 255))
	elif rowIndex == (self.data.rowCount-1):
		border = BorderFactory.createMatteBorder(1, 4, 8, 4, Color(255, 255, 255))
	elif colIndex == 0:
		border = BorderFactory.createMatteBorder(1, 8, 1, 4, Color(255, 255, 255))
	elif colIndex == (self.data.columnCount-1):
		border = BorderFactory.createMatteBorder(1, 4, 1, 8, Color(255, 255, 255))
	else:
		border = BorderFactory.createMatteBorder(1, 4, 1, 4, Color(255, 255, 255))
	if selected:
		return {'background': self.selectionBackground, 'border': border}
	elif rowView % 2 == 0:
		return {'foreground': 'white', 'background': Color(0, 0, 0), 'border': border}
	else:
		return {'foreground': 'white', 'background': Color(150, 150, 150), 'border': border}

Here is the result:

2 Likes

Thank you very much, @justinedwards.jle !

1 Like