I used what was above exactly, with the exception that I gave the JComboBox some items ( JComboBox(['foo','bar','baz']) )
Anyway, I guess since I'm necromancing I'll go ahead and post the solution:
If you want the JComboBox to drop down and be selectable, you have to do this in the configureEditor section, which is a bit more tricky. The cell will not look like a dropdown until you give it focus unless you configure the cell and the editor. I personally think it looks nicer when the dropdown only displays on focus
And since I trimmed that up a (tiny) bit, here's a JComboBox power table drop down selectyboi that does scale modes
from javax.swing import AbstractCellEditor,JComboBox
from javax.swing.table import TableCellEditor
class myTableCellEditor( TableCellEditor, AbstractCellEditor ):
def __init__(self, tableComponent):
self.table = tableComponent
self.comboBox = None
def getTableCellEditorComponent(self, table, value, isSelected, rowIndex, vColIndex):
# make a box. you could do a db query here or whatever
scaleModes = ['Off', 'Linear', 'Square Root', 'Exponential Filter', 'Bit Inversion']
self.comboBox = JComboBox(scaleModes)
# set the currently selected item
initialVal = self.table.data.getValueAt( rowIndex, 'Scale Mode' )
self.comboBox.setSelectedItem( initialVal )
return self.comboBox
def getCellEditorValue(self):
return self.comboBox.getSelectedItem()
if colName == 'Scale Mode':
return {'editor' : myTableCellEditor( self ) }
tl;dr: I should have searched better ¯\_(ツ)_/¯