Search code examples
javaif-statementjtextfield

If Statement in Bingo


I Have a Bingo Game that when you when a chip matches a number on the board the JTextfield goes YELLOW So for my BINGO Statement I wrote

                    if (B1.setBackground(Color.YELLOW) && I1.setBackground(Color.YELLOW)...){
                        System.out.println("BINGO");
                    }

But it's not working Is there anyway to actually do what I'm trying to do?


Solution

  • Your code structure should be:

    if (a chip matches a number on the board) {
       set background color for JTextfield to yellow;
       System.out.println("BINGO"); // <---- if this what you require
    }