Please can anyone help me with a simple sample on how to populate JCombobox with data(mysql etc) using Java persistence (JPA). I am quite new to this component so I desperately need help with this.

Edited 4 Years Ago by kwesiaryee

use addItem() method of JCombobox class for adding data to your combobox which is placed on your GUI.i d'not know exactly how to use JPA in java but the following code will help you see it

if you know how to read data using and for example (if your data is in result set object)

jComboBox1.removeAllItems();
/* update fresh data to JcomboBox1 component as follows*/
while(rs.next){
    jCombobox1.addItem(rs.getString(1));
}

all the best,
radha krishna.p

use addItem() method of JCombobox class for adding data to your combobox which is placed on your GUI.i d'not know exactly how to use JPA in java but the following code will help you see it

if you know how to read data using and for example (if your data is in result set object)

jComboBox1.removeAllItems();
/* update fresh data to JcomboBox1 component as follows*/
while(rs.next){
    jCombobox1.addItem(rs.getString(1));
}

all the best,
radha krishna.p

use addItem() method of JCombobox class for adding data to your combobox which is placed on your GUI.i d'not know exactly how to use JPA in java but the following code will help you see it

if you know how to read data using and for example (if your data is in result set object)

jComboBox1.removeAllItems();
/* update fresh data to JcomboBox1 component as follows*/
while(rs.next){
    jCombobox1.addItem(rs.getString(1));
}

all the best,
radha krishna.p

This article has been dead for over six months. Start a new discussion instead.