By calling setEnabled(false), you can disable a button and give it a muted appearance and make its
Question:
By calling setEnabled(false), you can disable a button and give it a muted appearance and make its listener unresponsive to clicks on it. Modify Figure 17.12’s program so that the factorial button is initially disabled. Enable it only after the user enters a character in the xBox text box. To enable it, create a key listener for the xBox text box, and have the key listener’s keyTyped event handler call setEnabled(true). Use the following key listener code skeleton:
Note extends KeyAdapter in the above class heading. An adapter class implements an interface by providing an empty-bodied method for each method in the interface. In this case, the KeyAdapter API class implements the KeyListener API interface.
Figure 17.12:
Step by Step Answer:
Introduction To Programming With Java A Problem Solving Approach
ISBN: 9781260575248
3rd International Edition
Authors: John Dean