Win a copy of Programmer's Guide to Java SE 8 Oracle Certified Associate (OCA) this week in the OCAJP forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

any idea about JComboBox Modal? with JDBC

 
Farhad Rahmati
Ranch Hand
Posts: 96
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi guys

I am using JDBC to connect to database and it's relational database which tables are related.

I have used combo box, list box and JTable

but I have a problem with combo box.

how do you retrieve and store data in a related table. I mean if you have primary key and foriegn keys with Dialog box.

I used modals and each combo box has modal.

but when you enter data, i tried to send the combo box index in to database . which is a stupid idea, and it's not working properly

I am looking for a method which modal shoul have it to retrieve data and send data.

thanks in advance
 
Rob Camick
Ranch Hand
Posts: 2612
9
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Not sure if I understand the question but here is a solution that allows you to store an Object in the combo box model. It will contain a String value which is visible in the combo box and and "int" value which can be used as the key to access data in the database:

 
Farhad Rahmati
Ranch Hand
Posts: 96
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thank you very much Rob

I think that is what I need

I just went through your code and I understand it. I will try it today and I'll let you know,

thank you very much
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic