Modal and Non-Modal Dialogs

Learn about the difference between modal and non-modal dialogs and when to use them.

Modal and non-modal dialogs

JDialog objects are modal by default. Opening a modal dialog stops the program until the dialog is closed. Opening a non-modal dialog lets the program code continue running while the dialog is open.

Getting rows, columns, and type from the dialog

Next, add public methods to retrieve the values of each instance variable.

  1. Create public methods called getRows(), getColumns(), and getMazeType(). These methods should each take no parameter and return the correct integer: rows, cols, or type, respectively.
...
____________ getRows(______) {
   return ___________;
}
____________ getColumns(______) { 
   return ___________;
}
____________ getMazeType(______) { 
   return ___________;
}
...

Get hands-on with 1200+ tech skills courses.