While working on a GUI project i am stuck with an error called null pointer error.
I am unable to resolve this problem.
The line which shows the error is closed by double asterisk on both sides(**).(line 80)
I have connected this with a SQL database and error erupts while assigning Jtable its value and structure.
package connectsqlite;
import java.awt.BorderLayout;
import java.awt.EventQueue;
import javax.swing.JFrame;
import javax.swing.JPanel;
import javax.swing.border.EmptyBorder;
import javax.swing.JLabel;
import java.awt.Font;
import javax.swing.JButton;
import java.awt.event.ActionListener;
import java.awt.event.ActionEvent;
import javax.swing.JTable;
import java.sql.*;
import javax.swing.*;
import net.proteanit.sql.DbUtils;
public class afterLogin extends JFrame {
    public JPanel contentPane;
    private JTable table;
    /**
     * Launch the application.
     */
    public static void main(String[] args) {
        EventQueue.invokeLater(new Runnable() {
            public void run() {
                try {
                    afterLogin frame = new afterLogin();
                    frame.setVisible(true);
                } catch (Exception e) {
                    e.printStackTrace();
                }
            }
        });
    }
    /**
     * Create the frame.
     */
    Connection connect = null;
    
    
    public afterLogin() {
        connect = sqliteConnection.conn();
        setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
        setBounds(100, 100, 695, 422);
        contentPane = new JPanel();
        contentPane.setBorder(new EmptyBorder(5, 5, 5, 5));
        setContentPane(contentPane);
        contentPane.setLayout(null);
        
        JButton btnBack = new JButton("Log out");
        btnBack.addActionListener(new ActionListener() {
            public void actionPerformed(ActionEvent e) {
                 Connecting window = new Connecting();
                 window.frame.setVisible(true);
                                                 
                
            }
        });
        btnBack.setBounds(10, 62, 114, 23);
        contentPane.add(btnBack);
        
        JButton btnNewButton = new JButton("Load Details");
        btnNewButton.addActionListener(new ActionListener() {
            public void actionPerformed(ActionEvent e) {
                try{
                    String query = "SELECT * FROM Appointments";
                    PreparedStatement pst = connect.prepareStatement(query);
                    ResultSet rs = pst.executeQuery();
                    **table.setModel(DbUtils.resultSetToTableModel(rs));**
                    
                }
                catch (Exception e1) {
                    e1.printStackTrace();
                }                           
            }
        }); 
        btnNewButton.setBounds(10, 28, 114, 23);
        contentPane.add(btnNewButton);
        
        JScrollPane scrollPane = new JScrollPane();
        scrollPane.setBounds(162, 57, 435, 305);
        contentPane.add(scrollPane);
        
        JScrollPane scrollPane_1 = new JScrollPane();
        scrollPane.setViewportView(scrollPane_1);
    }
}
 
     
     
    