#Buttons not re-enabling

1 messages · Page 1 of 1 (latest)

scarlet mulchBOT
#

<@&987246487241105418> please have a look, thanks.

#

Here is an AI assisted attempt to answer your question 🤖. Maybe it helps! In any case, a human is on the way 👍. To continue talking to the AI, you can use </chatgpt:1108714622413963314>.

#
TJ-Bot
I'm trying to create a matching game. I was able to restrict the amount of cards a user can pick to two, and the programs seems to disable the buttons after two are pressed - they are greyed out. After pressing the guess button, they are no longer greyed o

o prevent the user from selecting more than two cards at a time. However, I am encountering an issue where the buttons are not re-enabling after a mismatch is detected.

One possible solution is to keep track of the two selected cards in your code and create a method to check if they are a match or not. If they are not a match, you can re-enable the buttons and reset the selection.

You can also use JavaFX's property binding to dynamically enable or disable the buttons based on certain conditions. By binding the disabled property of the buttons to a boolean variable that indicates whether they should be enabled or not, you can easily toggle their state when needed.

Another approach is to handle button states using an event handler. When a button is clicked, check if it is already selected and handle the logic accordingly to either disable or enable it based on the game rules.

Overall, ensuring proper handling of button states and implementing logic to re-enable them when necessary will help resolve the issue of buttons not re-enabling in your matching game.

fierce radish
#

have you stepped through it with a debugger?

fierce radish
#

all JDKs come with a debugger. your IDE should have debugging support

#

which IDE are you using?

gaunt cave
#

For a school task I do recommend reducing the duplication a bit.