> I have a JTable, which has in column 1-3 comboboxes. The JTable has a
> model. I get the values in the combobox from a database.
[quoted text clipped - 4 lines]
> fill up the combobox out from the JTable model if I would make combobox
> protected. Is this an ugly solution?
Can you post some sample code to make this clearer.
As general advice, you definitely don't want your table model class to
know anything about GUI classes like JComboBox. You would need to
handle the translation from the data model to GUI components elsewhere.

Signature
www.designacourse.com
The Easiest Way To Train Anyone... Anywhere.
Chris Smith - Lead Software Developer/Technical Trainer
MindIQ Corporation
Liz - 20 Jun 2005 19:39 GMT
creating a combobox model will be a overkill. Just additem should
sufficient, unless you would like to resuse the combobox data in
comboxboxes through out your application.
JTable doesn't have the feature of filling a combobox with a database
query. In my experience, I have tried to use free QuickTable java
component (http://quicktable.org) which is an implementation on top of
JTable , but hides all the complexities and allows to use the JTable
methods.
In quicktable you need to just make one call, to bind a column with a
database query combobox.
quicktable.getColumn(0).setBoundSql("select department from company");
No need to create any cellrenderer ir editor.
API help can be found at
http://quicktable.org/doc/quick/dbtable/Column.html#setBoundSql(java.lang.String)