[Logo]
Forums Register Login
SetEditable is not working with combobox
I am working with table and using combo box in cell of table in certain condition I have to make combo as editable and non editable.

I have written class which extends DefaultCellEditor

@Override
public Component getTableCellEditorComponent(JTable table, Object value, boolean flag, int row, int column)
{
comboBox.getModel()).setSelectedItem(value.toString());
comboBox.setEditable(true);
}

if i set comboBox.setEditable(true). cell become editable but not able to select any item from combo that value is not come in cell.

but when i do set comboBox.setEditable(false) cell become non editable but now i can select value from combo.

i want both the operations. Editable cell and able to pick value from combo.

Any Idea???

Prashant Gour
Hai,

You need to set that particular cell as a non editable one, that is cell in which you had added the combobox.

rgds,
gopinath
actully i want to select item from combo and to enter value in cell. but that is not working.
any other suggestions. please let me know.

Prashant Gour
 

Originally posted by prashant gour:
if i set comboBox.setEditable(true). cell become editable but not able to select any item from combo that value is not come in cell.



That sounds strange, although it wouldn't at all surprise me if this was a bug in Swing - wouldn't be the only one regarding JTables... :sigh:

I'd search in the sun bug parade for this, if I were you.
I miss the old days when I would think up a sinister scheme for world domination and you would show a little emotional support. So just look at this tiny ad:
Why should you try IntelliJ IDEA ?
https://coderanch.com/wiki/696337/IntelliJ-IDEA


This thread has been viewed 1606 times.

All times above are in ranch (not your local) time.
The current ranch time is
Aug 17, 2018 15:34:02.