title: Eclipse Jtable doesn't displays errors but doesn't displays data as well
body: <p>I am new in Java and I was trying to do this exercise; but I just stuck at this new issue. I googled about this error all day long- Java.lang.NullPointerException -and  I tried to solve it but I can't find it; anyone please? </p>
  
  <p>** I have a BankDB_Final.db file; and it have a table called: Bank_001
  ** I have installed sqlite connector ( the connection is ok) and
     rs2xml.jar file in the same folder called "lib". 
  ** Login: Abbas .. Password: root.</p>
  
  <p>Here is the methods code: 
   // Launch the application.</p>
  
  <pre><code>import java.awt.*;
  import java.sql.*;
  
  import javax.swing.*;
  import javax.swing.border.EmptyBorder;
  import javax.swing.border.TitledBorder;
  import java.awt.event.ActionListener;
  import java.awt.event.ActionEvent;
  
  
  public class Login_jFrame extends JFrame {
  
  Connection conn = null;
  ResultSet rs = null;
  PreparedStatement pst = null;
  
  private JPanel contentPane;
  private JPasswordField txt_password;
  
  /**
   * Launch the application.
   */
  public static void main(String[] args) {
      EventQueue.invokeLater(new Runnable() {
  
          public void run() {
              try {
                  Login_jFrame frame = new Login_jFrame();
                  frame.setVisible(true);
              } catch (Exception e) {
                  e.printStackTrace();
              }
          }
      });
  }
  
  /**
   * Create the frame.
   */
  public Login_jFrame() {
  
      conn = javaconnect.ConnectrDB();
  
  
      setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
      setBounds(100, 100, 450, 300);
      contentPane = new JPanel();
      contentPane.setBorder(new EmptyBorder(5, 5, 5, 5));
      setContentPane(contentPane);
      contentPane.setLayout(null);
  
      JLabel lblNewLabel = new JLabel("Username");
      lblNewLabel.setFont(new Font("Tahoma", Font.PLAIN, 12));
      lblNewLabel.setBounds(177, 93, 70, 14);
      contentPane.add(lblNewLabel);
  
      JLabel lblNewLabel_1 = new JLabel("Password");
      lblNewLabel_1.setFont(new Font("Tahoma", Font.PLAIN, 12));
      lblNewLabel_1.setBounds(177, 139, 70, 14);
      contentPane.add(lblNewLabel_1);
  
      txt_password = new JPasswordField();
      txt_password.setBounds(253, 133, 100, 20);
      contentPane.add(txt_password);
  
      TextField txt_username = new TextField();
      txt_username.setBounds(253, 85, 100, 22);
      contentPane.add(txt_username);
  
      JPanel panel = new JPanel();
      panel.setBorder(new TitledBorder(new TitledBorder(new TitledBorder(UIManager.getBorder("TitledBorder.border"), "Login", TitledBorder.LEADING, TitledBorder.TOP, null, new Color(0, 0, 0)), "Login:", TitledBorder.LEADING, TitledBorder.TOP, null, new Color(64, 64, 64)), "Login:", TitledBorder.LEADING, TitledBorder.TOP, null, Color.DARK_GRAY));
      panel.setBounds(160, 50, 219, 160);
  
      contentPane.add(panel);
      panel.setLayout(null);
  
      JButton cmdLogin = new JButton("Login");
      cmdLogin.addActionListener(new ActionListener() {
          public void actionPerformed(ActionEvent arg0) {
              String sql = "select * from bank_001 where AccountName=? and Password=?";
              try{
                  pst = conn.prepareStatement(sql);
                  pst.setString(1, txt_username.getText());
                  pst.setString(2, txt_password.getText());
  
                  rs= pst.executeQuery();
                  if(rs.next()) {
                      Employee_info s = new Employee_info();
                      s.setVisible(true);
  
                      JOptionPane.showMessageDialog(null, "Username and Password is correct!");
  
                  }else {
                      JOptionPane.showMessageDialog(null, "Username or Password is Not correct!");
                  }
  
              }catch(Exception e) {
  
                  JOptionPane.showMessageDialog(null, e);
  
              }
  
          }
      });
      cmdLogin.setBounds(90, 126, 89, 23);
      panel.add(cmdLogin);
  
      JLabel icon = new JLabel("");
      icon.setIcon(new ImageIcon("C:\\Users\\User\\Downloads\\DB SQLITE\\Project123\\img\\icon.jpg"));
      icon.setBounds(40, 56, 90, 90);
      contentPane.add(icon);
  }
  </code></pre>
  
  <p>}</p>
  
  <p>JavaConnect Class:</p>
  
  <pre><code>import java.sql.*;
  
  import javax.swing.*;
  
  
  public class javaconnect {
  
  Connection conn = null;
  
  public static Connection ConnectrDB() {
  
      // 1- Get a connection to Database
      try {
  
          Class.forName("org.sqlite.JDBC");
          Connection conn = DriverManager.getConnection("jdbc:sqlite:c:\\users\\user\\downloads\\db sqlite\\bankdb_final.db");
          //Connection conn = DriverManager.getConnection("jdbc:sqlite:C:\\Users\\User\\Downloads\\DB SQLITE\\BankDB_Final.db");
  
          JOptionPane.showMessageDialog(null, "Connection Established");
  
          return conn;
      } catch(Exception e) {
  
       JOptionPane.showMessageDialog(null, e);
     return null;
  
      }
  
  }
  </code></pre>
  
  <p>}</p>
  
  <p>and Finally (I think here is the Error) Employee_info Class</p>
  
  <pre><code>import java.awt.BorderLayout;
  import java.awt.EventQueue;
  
  import javax.swing.JFrame;
  import javax.swing.JPanel;
  import javax.swing.border.EmptyBorder;
  import javax.swing.JTable;
  import javax.swing.border.LineBorder;
  
  import java.awt.Color;
  
  import javax.swing.table.DefaultTableModel;
  
  import java.sql.*;
  import javax.swing.*;
  
  import net.proteanit.sql.DbUtils;                 
  
  public class Employee_info extends JFrame {
  
  
  
  private JPanel contentPane;
  private JTable table_employee;
  
  
  
  /**
   * Launch the application.
   */
  public static void main(String[] args) {
      EventQueue.invokeLater(new Runnable() {
          public void run() {
              try {
                  Employee_info frame = new Employee_info();
                  frame.setVisible(true);
              } catch (Exception e) {
                  e.printStackTrace();
              }
          }
      });
  }
  Connection conn = null;
  ResultSet rs = null;
  PreparedStatement pst = null;             
  
  /**
   * Create the frame.
   */
  public Employee_info() {
  
  
      conn = javaconnect.ConnectrDB();
      Update_Table();
  
  
      setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
      setBounds(100, 100, 450, 300);
      contentPane = new JPanel();
      contentPane.setBorder(new EmptyBorder(5, 5, 5, 5));
      setContentPane(contentPane);
      contentPane.setLayout(null);
  
      JScrollPane scrollPane = new JScrollPane();
      scrollPane.setBounds(21, 11, 389, 230);
      contentPane.add(scrollPane);
  
      table_employee = new JTable();
      scrollPane.setViewportView(table_employee);
      table_employee.setModel(new DefaultTableModel(
          new Object[][] {
          },
          new String[] {
          }
      ));
  }
  
  
  private void Update_Table() {
      try {
  
      String sql = "select * from Bank_001";
      pst = conn.prepareStatement(sql);
      rs = pst.executeQuery();
      table_employee.setModel(DbUtils.resultSetToTableModel(rs));
      conn.close();
  
      }catch(Exception e) {
           JOptionPane.showMessageDialog(null, e);
  
      }
  
  }
  </code></pre>
  
  <p>}</p>
  
  <p>Screen : </p>
  
  <p><a href="https://i.stack.imgur.com/2pxIv.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/2pxIv.png" alt="enter image description here"></a></p>