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.

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

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.