jeudi 23 juillet 2015

How do i add table heading while loading a table in my JAVA GUI from sqlite database in eclipse?

Ok, so i am learning how to use sqlite database with JAVA and i am learning the various operations. One operation that i came across was loading the records from the sqlite database to my table in my GUI program. Now, my program really works fine and it shows no problem but wouldn't it be better if i can a header to my table when it loads the data from the sqlite database. Can someone please help me out as how i can add this feature to my program. Here is the load records from table method.

btnLoadallrecords = new JButton("LoadAllRecords");

        btnLoadallrecords.addActionListener(new ActionListener() {
            public void actionPerformed(ActionEvent e) {

PreparedStatement pat;

                try {
                    String query = "select Lender,Borrower,Money,Date from Records";
                    pat = connection.prepareStatement(query);

                    ResultSet rs = pat.executeQuery();
                    table.setModel(DbUtils.resultSetToTableModel(rs));





                }

                catch (Exception j)
                {

                }


                }

Aucun commentaire:

Enregistrer un commentaire