private void createNodes(DefaultMutableTreeNode top) {
        DefaultMutableTreeNode generalForums = null;
        DefaultMutableTreeNode category = null;
        DefaultMutableTreeNode subCategory = null;
        DefaultMutableTreeNode question = null;

        generalForums = new DefaultMutableTreeNode("General Forums");
        top.add(generalForums);
        
        DatabaseConnection db = new DatabaseConnection();
        Connection conn = db.connectToDB();
        
        // Query for total Forum topics
        // Gets all topics in the forums.
        String sql = "SELECT * FROM `ForumCategories`";
        
        ResultSet rs = db.getResults(conn, sql);
        int categoryID = 0;
        int subCategoryID = 0;
        try {
            while (rs.next())
            {
                category = new DefaultMutableTreeNode(rs.getString("Name"));
                generalForums.add(category); //Adds Category to General Forums
                
                //Queries for all the subCategories inside the main generalForums
                //IE: Math is a category of the Category "Queries"
                categoryID = rs.getInt("CategoryID");
                String subSQL = "SELECT * FROM `ForumSubCategories` WHERE CategoryID = '"+categoryID+"'"; 
                ResultSet subRS = db.getResults(conn, subSQL);
                while (subRS.next())
                {
                    subCategory = new DefaultMutableTreeNode(subRS.getString("Name"));
                    category.add(subCategory); //Adds subCategory "math" to Category "queries"
                    
                    //Queries for all questions inside subcategory
                    subCategoryID = subRS.getInt("SubCategoryID");
                    String questionSQL = "SELECT * FROM `ForumQuestions` "
                            + "WHERE SubCategoryID = '"+subCategoryID+"'";
                    if (userType == 1)
                    {
                        questionSQL += " and (Visibility = 0 or Author='"+ userID + "')";
                    }
                    ResultSet questionRS = db.getResults(conn, questionSQL);
                    
                    while(questionRS.next())
                    {
                        String questionTitle = questionRS.getString("QuestionTitle");
                        String questionContent = questionRS.getString("Question");
                        int questionID = questionRS.getInt("QuestionID");
                        
                        question = new DefaultMutableTreeNode(new BookInfo(questionTitle, questionContent, questionID, 1));
                        subCategory.add(question); //Adds question Pythag to subCategory Math
                        
                        getAnswers(db, conn, question, questionID); //Gets answers for question
                    }
                
                }
            }
        } catch (SQLException ex) {
            Logger.getLogger(HelpDeskMainFrame.class.getName()).log(Level.SEVERE, null, ex);
        }
    }