Can I make a column in a JTable use a JList so that I can pick multiple values for the column in each row? My example is a JTable of users with name, user groups, email address, manager name and a check box to allow sending of email. Each user can be a member of 1:n user groups defined in another JTable.
Are you saying that you want each cell in one column of a JTable to allow a choice from a set of data defined elsewhere? Typically, you would use a JComboBox, rather than a JList, but you could do either. Create a class extending TableCellEditor that returns a JComboBox (or JList) as the editor component. You will have to figure out how to grab the values from your other table at that point. Set that TableCellEditor as the editor for that column of your JTable (table.setDefaultEditor). You may also want to create a TableCellRenderer class for when the cell is being displayed, but not edited (table.setDefaultRenderer). The class that you use as the argument in these methods should be the same that you specify in getColumnClass of your TableModel.
or something like that. Hope this helps.
I’m tired of walking, and will rest for a minute and grow some wheels. This is the promise of this tiny ad:
how do I do my own kindle-like thing - without amazon