[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.
The City calls upon her steadfast protectors. Now for a tiny ad:
ScroogeXHTML 7.1 - RTF to HTML5 / XHTML converter
https://coderanch.com/t/690611/ScroogeXHTML-RTF-HTML-XHTML-converter


This thread has been viewed 1460 times.

All times above are in ranch (not your local) time.
The current ranch time is
Feb 18, 2018 19:12:41.