Question: By calling setDisable(true), you can disable a button and give it a muted (grayed out) appearance and make its handler unresponsive to clicks on it.
By calling setDisable(true), you can disable a button and give it a muted (grayed out) appearance and make its handler unresponsive to clicks on it. Modify the FactorialButton program so that the button is initially disabled. Enable it only after the user types a key when the xBox text box has focus. When the user clicks the Factorial button, calculate and display the factorial and disable the button.
(1) Declare btn to be an instance variable.
(2) Instead of calling setOnAction, have your xBox control call setOnKeyTyped, like this: xBox.setOnKeyTyped(e -> btn.setDisable(false));
Step by Step Solution
3.32 Rating (164 Votes )
There are 3 Steps involved in it
The question is asking to modify a FactorialButton program You would need to declare btn as an insta... View full answer
Get step-by-step solutions from verified subject matter experts
