public comet_fines() {
         initComponents();
        try{
         Class.forName("com.mysql.jdbc.Driver");    
         conn = DriverManager.getConnection("jdbc:mysql://localhost:3306/library_management", "root", "welcome6" );        
         java.sql.Timestamp date = new java.sql.Timestamp(new java.util.Date().getTime());
         
         String s = "select * from fines ";
         PreparedStatement ps = conn.prepareStatement(s);
       
         ResultSet rs = ps.executeQuery();
         
          ResultSetMetaData meta = rs.getMetaData();
         int numberOfColumns = meta.getColumnCount();
         
         
           if (!rs.next()){
               
          JOptionPane.showMessageDialog(this, "None of the loans have any fine!");
          jTable1.repaint();
         return;
}
           
         
              while (jTable1.getRowCount() > 0) {
            ((DefaultTableModel) jTable1.getModel()).removeRow(0);
        }
             
        rs.previous();
         while (rs.next()) {
               Object [] rowData = new Object[numberOfColumns]; 
                   
                
                    rowData[0] = rs.getInt(1); 
                    rowData[1] = rs.getFloat(2);
                    rowData[2] = rs.getBoolean(3);
                   
             ((DefaultTableModel) jTable1.getModel()).insertRow(rs.getRow() - 1,rowData); 
            
         }
          jTable1.setCellSelectionEnabled(false); 
          jTable1.setRowSelectionAllowed(true);    
        jTable1.setRowSelectionAllowed(true);
         
         
        conn.close();
        }
         catch(SQLException ex) {
			System.out.println("Error in connection: " + ex.getMessage());
		}
        catch (ClassNotFoundException ex)
        {
            System.out.println("Class not found:" + ex.getMessage());
        } 
          
    }