I created small form in Java in which used JTable
and to fill the table. I used the following code.
import net.proteanit.sql.DbUtils;
try
{
CreateConnection();
PreparedStatement st =conn.prepareStatement("Select * from ABC;");
ResultSet rs = st.executeQuery();
jtable_clock.setModel(DbUtils.resultSetToTableModel(rs));
conn.close();
}
catch(Exception ex)
{
JOptionPane.showMessageDialog(null, ex.toString());
}
Here everything works fine but I am unable to set Column Names in my table.
I am getting data from table ABC but how can I set Column Names in table?