Custom Dialog
Learn to create a custom dialog of options for the Maze Generator program.
What is a dialog?
Dialogs are separate windows that display information and usually gather additional information from the program user.
Adding maze and anti-maze variables
To create a custom dialog of options for the Maze Generator program, we must first create instance variables for the different types of mazes.
In the MazeGenerator.java
file:
- Create two public static final integer instance variables called
TYPE_MAZE
andTYPE_ANTIMAZE
, set to0
and1
, respectively. - Create a private integer instance variable called
type
, initialized toTYPE_ANTIMAZE
.
...
private static final long serialVersionUID = 1L;
public static final int TYPE_MAZE = 0;
public static final int TYPE_ANTIMAZE = 1;
public int type = TYPE_ANTIMAZE;
...
Add the above lines of code to create the instance variables for different types of mazes.
Get hands-on with 1200+ tech skills courses.