a recursion error but i do not have recursion

i have a client-server architecture game. it’s designed with swing GUI, i have a problem in the game class, the class is supposed to show the 3 players’ names and scores, each time a player answers it should update the jLabel for that player

i wrote this code to update the label for the player who answered correct;y but it gave me an error:Exception in thread “AWT-EventQueue-0” Exception in thread “AWT-EventQueue-0” Exception in thread “AWT-EventQueue-0” java.lang.StackOverflowError

i asked and turned out to be an infinite recursion error but i don’t have any recursive methods in my codes nor have i called one, the error disappears when i delete this part of code (the SUBMITWORD method) but i can’t do this since it’s an important functionality.

i would be glad if someone could figure out the issue

here’s the code:

    import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.Random;
import javax.swing.JOptionPane;


public class Game extends javax.swing.JFrame {

    public String s1 = "aufiojdnble";
    public String s2 = "gfyrhebdsho";
    Info info = new Info();
    public int correctAnswersCount = 0;
    public int player1ans = 0;
    public int player2ans = 0;
    public int player3ans = 0;
    public Server server ;
    public String currentString;
    public List<String> predefinedWordsS1 = List.of("found", "bad", "lion", "audio", "fun","job", "no", "bold", "bad", "no", "food", "blonde", "noble");
    public List<String> predefinedWordsS2 = List.of("dog", "boy", "good", "her", "red", "hey", "yes", "fry", "hero", "shy", "bed", "shore", "body", "shoes");


    public Game() {
        initComponents();
        displayLetters();
    }
    
    ////////////////////////////////////////////////////////////////////////////
    
    public void updatePlayerLabels(String[] playerNames) {
    // System.out.println("Received player list from server: " + Arrays.toString(playerNames));

        if (playerNames.length >= 1) {
            jLabel4.setText(playerNames[0]);
        }
        if (playerNames.length >= 2) {
            jLabel5.setText(playerNames[1]);
        }
        if (playerNames.length >= 3) {
            jLabel6.setText(playerNames[2]);
        }
    }
    
    ////////////////////////////////////////////////////////////////////////////
    
    public void displayLetters() { // works
    currentString = wordSequence();
    jLabel2.setText(currentString);
    }
    
    ////////////////////////////////////////////////////////////////////////////
    
    public String wordSequence() { // works
        // Generate a random number (0 or 1)
        Random random = new Random();
        int randomNumber = random.nextInt(2);
        return (randomNumber == 0) ? s1 : s2;
    }
    
    ////////////////////////////////////////////////////////////////////////////
    
    public void submitWord(String word) {
    if (isValidWord(word, currentString)) {
        correctAnswersCount++;
        String name = info.getUsername();
        String player1 = jLabel4.getText();
        String player2 = jLabel5.getText();
        String player3 = jLabel6.getText();
        if (name.equalsIgnoreCase(player1)) {
            player1ans++;
            jLabel13.setText(String.valueOf(player1ans));
            if (player1ans == 5) {
                JOptionPane.showMessageDialog(this, "Congratulations! " + player1 + " has won the game!");
            }
        } else if (name.equalsIgnoreCase(player2)) {
            player2ans++;
            jLabel14.setText(String.valueOf(player2ans));
            if (player2ans == 5) {
                JOptionPane.showMessageDialog(this, "Congratulations! " + player2 + " has won the game!");
            }
        } else if (name.equalsIgnoreCase(player3)) {
            player3ans++;
            jLabel15.setText(String.valueOf(player3ans));
            if (player3ans == 5) {
                JOptionPane.showMessageDialog(this, "Congratulations! " + player3 + " has won the game!");
            }
        } else {
            JOptionPane.showMessageDialog(this, "Invalid word. Please try again.");
        }
        jTextField1.setText("");
    }
}

    
    ////////////////////////////////////////////////////////////////////////////
    
    public boolean isValidWord(String word, String currentString) { // works
    // Get the list of predefined words based on the currently displayed string
    List<String> predefinedWords;
    if (currentString.equals(s1)) {
        predefinedWords = predefinedWordsS1;
    } else if (currentString.equals(s2)) {
        predefinedWords = predefinedWordsS2;
    } else {
        return false;
    }

    // Check if the entered word is in the list of predefined words
    return predefinedWords.contains(word);
    }

    private void initializeComponents() {
    initComponents();
    jLabel4.setText("");
    jLabel5.setText("");
    jLabel6.setText("");
}

Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa Dịch vụ tổ chức sự kiện 5 sao Thông tin về chúng tôi Dịch vụ sinh nhật bé trai Dịch vụ sinh nhật bé gái Sự kiện trọn gói Các tiết mục giải trí Dịch vụ bổ trợ Tiệc cưới sang trọng Dịch vụ khai trương Tư vấn tổ chức sự kiện Hình ảnh sự kiện Cập nhật tin tức Liên hệ ngay Thuê chú hề chuyên nghiệp Tiệc tất niên cho công ty Trang trí tiệc cuối năm Tiệc tất niên độc đáo Sinh nhật bé Hải Đăng Sinh nhật đáng yêu bé Khánh Vân Sinh nhật sang trọng Bích Ngân Tiệc sinh nhật bé Thanh Trang Dịch vụ ông già Noel Xiếc thú vui nhộn Biểu diễn xiếc quay đĩa Dịch vụ tổ chức tiệc uy tín Khám phá dịch vụ của chúng tôi Tiệc sinh nhật cho bé trai Trang trí tiệc cho bé gái Gói sự kiện chuyên nghiệp Chương trình giải trí hấp dẫn Dịch vụ hỗ trợ sự kiện Trang trí tiệc cưới đẹp Khởi đầu thành công với khai trương Chuyên gia tư vấn sự kiện Xem ảnh các sự kiện đẹp Tin mới về sự kiện Kết nối với đội ngũ chuyên gia Chú hề vui nhộn cho tiệc sinh nhật Ý tưởng tiệc cuối năm Tất niên độc đáo Trang trí tiệc hiện đại Tổ chức sinh nhật cho Hải Đăng Sinh nhật độc quyền Khánh Vân Phong cách tiệc Bích Ngân Trang trí tiệc bé Thanh Trang Thuê dịch vụ ông già Noel chuyên nghiệp Xem xiếc khỉ đặc sắc Xiếc quay đĩa thú vị
Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa
Thiết kế website Thiết kế website Thiết kế website Cách kháng tài khoản quảng cáo Mua bán Fanpage Facebook Dịch vụ SEO Tổ chức sinh nhật