Win a copy of Murach's MySQL this week in the JDBC and Relational Databases forum!
  • 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
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

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
 
Whip out those weird instruments of science and probe away! I think it's a tiny ad:
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic