I'm new to Java and trying to make a simple program that will display the data inside the database. My problem here is I have 20 columns and I can't see the data or even the column title because it is too crowded. I tried combine it with JScrollPane and still doesn't work.
Here is my code
import java.sql.*;
import javax.swing.*;
import net.proteanit.sql.DbUtils;
public class ManageDatabase extends javax.swing.JFrame {
Connection conn = null;
ResultSet rs = null;
PreparedStatement pst = null;
/**
* Creates new form ManageDatabase
*/
public ManageDatabase() {
initComponents();
conn=javaconnect.ConnectDb();
Update_table();
}
private void Update_table(){
try {
String sql = "Select * from table_AOD_Pump_Accessories";
pst=conn.prepareStatement(sql);
rs=pst.executeQuery();
Table_AOD_Pump_Accessories.setModel(DbUtils.resultSetToTableModel(rs));
}
catch(Exception e){
JOptionPane.showMessageDialog(null, e);
}
}