• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • paul wheaton
  • Jeanne Boyarsky
  • Ron McLeod
Sheriffs:
  • Paul Clapham
  • Liutauras Vilda
  • Devaka Cooray
Saloon Keepers:
  • Tim Holloway
  • Roland Mueller
Bartenders:

Select item in jcombobox in jtable

 
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
Ranch Hand
Posts: 174
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
There were millions of the little blood suckers. But thanks to this tiny ad, I wasn't bitten once.
Smokeless wood heat with a rocket mass heater
https://woodheat.net
reply
    Bookmark Topic Watch Topic
  • New Topic