我正在使用 DefaultTable 模型在 Jtable 中显示我的记录。但是在图片中存在一个问题。当我加载 jtable 时,它的显示类似于 LJava.lang.Object 类型。不在字符串中..我该如何解决这个问题。这是我的代码;
EntityManagerFactory emf = Persistence.createEntityManagerFactory("SwingDenemePU");
EntityManager em = emf.createEntityManager();
Query sorgu = em.createQuery("select p from Personel p where p.personelAdSoyad like :ad");
Object[] kolonAdi = {"AD SOYAD","ÜNVAN ADI"};
sorgu.setParameter("ad", jTextField1.getText()+"%");
personelList = sorgu.getResultList();
Object[][] data = new Object[personelList.size()][kolonAdi.length];
for(int m=0; m<personelList.size(); m++)
for(int n=0; n<kolonAdi.length; n++)
for(Personel o : personelList) {
Personel personel = (Personel)o;
data[m][n] = new Object[][]{
{
personel.getPersonelAdSoyad(),
personel.getUnvanID().getUnvanAdi()
}
};
}
DefaultTableModel def = new DefaultTableModel();
def.setDataVector(data, kolonAdi);
jTable1.setModel(def);