Win a copy of Kotlin in Action this week in the Kotlin forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

JComboBox problem  RSS feed

 
miguel lisboa
Ranch Hand
Posts: 1281
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
i've this object (Tecnica) and in it i have a toString method that returns Tecnica's name.

in order to dinamically populate my combo i have an HQL query "from Tecnica as t order by t.nome asc"; this query returns a list of Tecnica objects; i iterate the list to populate the combo:


in fact my combo gets populated (Tecnica's names appear in combo)

now, i've methods that allow user to navigate through some objects (Contrato) (which includes Tecnica); what i want is that my gui gets populated with the apropriated Tecnica value;

in order to achieve it, when i get my Object (contrato) from database, i populate my gui:


what happens is that this does not work at all: combo allways dysplays first (Tecnica) name in list - i mean my method does not work

How can i solve this?
What am i doing wrong?

TiA

EDIT:
i tried also
but with no result

its curious that in my gui i use (with absolute success) a similar way to populate combos when these have strings instead...
[ August 27, 2005: Message edited by: miguel lisboa ]
 
miguel lisboa
Ranch Hand
Posts: 1281
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
i guess i found a way out:

this way (aint fully tested yet) works
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!