I created a JScrollPane and a jTable in it, all inside a JInternalFrame, but when I run my Jframe and open this JInternalFrame, it only shows the data in lines that are in my database, but it does not show up there column names. JInternalFrame code
public class Listar extends javax.swing.JDialog {
private AnnotationResolver resolver;
private ObjectTableModel otm;
private UsuarioDao dao;
/**
* Creates new form Listar
* @param parent
* @param modal
*/
public Listar(java.awt.Frame parent, boolean modal) {
super(parent, modal);
initComponents();
resolver = new AnnotationResolver(modelo.Usuario.class);
otm = new ObjectTableModel(resolver, "nome,sobrenome,email,departamento");
try {
dao = new UsuarioDao();
otm.setData(dao.listarTodasAsPessoaList());
jTable1.setModel(otm);
} catch (SQLException ex) {
Logger.getLogger(Listar.class.getName()).log(Level.SEVERE, null, ex);
}
}
private void initComponents() {
jScrollPane1 = new javax.swing.JScrollPane();
jTable1 = new javax.swing.JTable();
jTable1.setModel(new javax.swing.table.DefaultTableModel(
new Object [][] {
{null, null, null, null},
{null, null, null, null},
{null, null, null, null},
{null, null, null, null}
},
new String [] {
"Title 1", "Title 2", "Title 3", "Title 4"
}
));
jScrollPane1.setViewportView(jTable1);
javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
getContentPane().setLayout(layout);
layout.setHorizontalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addGap(43, 43, 43)
.addComponent(jScrollPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 385, javax.swing.GroupLayout.PREFERRED_SIZE)
.addContainerGap(75, Short.MAX_VALUE))
);
layout.setVerticalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addGap(26, 26, 26)
.addComponent(jScrollPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 283, javax.swing.GroupLayout.PREFERRED_SIZE)
.addContainerGap(102, Short.MAX_VALUE))
);
pack();
} private javax.swing.JScrollPane jScrollPane1;
private javax.swing.JTable jTable1;}