Cancel Dialog Changes
Learn how to cancel any changes made in the dialog.
We'll cover the following
Cancelling changes by closing the dialog
Add the instance variable needed to keep track of whether the user canceled his changes.
- Go back to
OptionsDialog.java
. - Add a private boolean instance variable called
canceled
, initialized totrue
. - Add a method called
isCanceled()
. It should take no parameters and return a boolean:canceled
.
...
private int cols = 0;
private int type = 0; _____________ canceled = ________;
...
_____________ isCanceled(______) {
return ____________;
}
...
Get hands-on with 1200+ tech skills courses.