This week's book giveaway is in the Servlets forum.
We're giving away four copies of Murach's Java Servlets and JSP and have Joel Murach on-line!
See this thread for details.
The moose likes Swing / AWT / SWT and the fly likes SetEditable is not working with combobox Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "SetEditable is not working with combobox " Watch "SetEditable is not working with combobox " New topic
Author

SetEditable is not working with combobox

prashant gour
Ranch Hand

Joined: Feb 07, 2006
Posts: 45
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
Gopinath Mani
Greenhorn

Joined: Sep 29, 2006
Posts: 2
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
prashant gour
Ranch Hand

Joined: Feb 07, 2006
Posts: 45
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
Ilja Preuss
author
Sheriff

Joined: Jul 11, 2001
Posts: 14112
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 soul is dyed the color of its thoughts. Think only on those things that are in line with your principles and can bear the light of day. The content of your character is your choice. Day by day, what you do is who you become. Your integrity is your destiny - it is the light that guides your way. - Heraclitus
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: SetEditable is not working with combobox
 
Similar Threads
TableCellEditor ComboBox in JTable
JCOMBO Box traversal problem
JXTable - Changing cell forground Colour
JTable and Combobox editor
JComboBox setEditor()