• Post Reply Bookmark Topic Watch Topic
  • New Topic

Select item in jcombobox in jtable  RSS feed

 
Nuno Prudencio
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi everyone,

I can insert a jcombobox in a jtable cell. Is updated by a button. But i cannot select a default object in a combobox.

I have the following code in the button "update"


and i have the following TableCellRender



Anybody can help me?

Regards
 
m Korbel
Ranch Hand
Posts: 174
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
- use XxxTableModel.setValueAt(string_thats_match_with_JComboBox_Items), then you are set the initial value for XxxTableCellEditor/Renderer

____________________________________________________________________________

"I can insert a jcombobox in a jtable cell. Is updated by a button. But i cannot select a default object in a combobox."

- your implemetation of TableCellRenderer is wrong, JTable is designated to show value stored in XxxTableModel (see XxxTableModel.setValueAt)

- for more (and to use exclusivelly) information to read Oracle tutorial How to use Tables, part Using a Combo Box as an Editor
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!