I have a JTable with 17 columns. The last 15 columns contain airport
codes (this is used
for entering a flight schedule). The application uses a list of 5000
airport codes.
When I do:
column.setCellEditor(new MyComboBoxEditor(airportValues));
for each column it is very slow.
Is it possible to only use 1 combobox and reuse and activate it as a
celleditor when I click on a particular cell?
Can someone give me a hint how to do this?
regards
john
Roedy Green - 14 Nov 2005 14:08 GMT
>Can someone give me a hint how to do this?
You could build a static JComboBox, populate it, and just add/remove
it as needed.

Signature
Canadian Mind Products, Roedy Green.
http://mindprod.com Java custom programming, consulting and coaching.
zero - 14 Nov 2005 18:56 GMT
awvvo@hotmail.com wrote in news:1131973892.061247.56910
@g44g2000cwa.googlegroups.com:
> I have a JTable with 17 columns. The last 15 columns contain airport
> codes (this is used
[quoted text clipped - 13 lines]
> regards
> john
I assume MyComboBoxEditor extends TableCellEditor?
Subclass the JTable and override the TableCellEditor getCellEditor(int
row, int column) method. Like this:
public class MyJTable extends JTable
{
private MyComboBoxEditor comboEditor =
new MyComboBoxEditor(airportValues);
// ...
public TableCellEditor getCellEditor(int row, int column)
{
if(column > 2)
{
// if necessary, change the comboEditor values
return comboEditor;
}
return super.getTableCellEditor(row, column);
}
}
Customize to suit your needs.
zero