如何使用我的 jpa 列表中的数据填充 Jcombobox?急需帮助
public static MyNames myNames() {
EntityManagerFactory emf = Persistence.createEntityManagerFactory("JavaTrialsPU");
EntityManager em = emf.createEntityManager();
em.getTransaction().begin();
Query q = em.createNamedQuery("MyNames.findAll");
MyNames n = (MyNames) q.getResultList();
return n;
}
public static void myCombo() {
comboBox = new JComboBox(????--how can i make the jcombobox display my myNames() list--?????);
frame.add(comboBox, BorderLayout.PAGE_START);
}