It is important that you understand what a modal dialog is.
Currently the MainMenu
is starting the ProductEditor
in modal mode. Test this by running the Main
class clicking the <
ProductEditor
dialog out of the way and click the button on the
MainMenu
again?
Let's make the dialog non-modal. Open the button click handler in the MainMenu
frame. In the line of code that creates the ProductEditor
dialog instance change the boolean parameter to false
. Test the system again. Can you open multiple ProductEditor
dialogs now?
This is quite dangerous since we now have to worry about bugs that can be created by having multiple instances of the dialogs being used by the user concurrently. For example, what would happen if the user managed to edit a product and then delete the same product from a different dialog before saving the edited product? Nothing good.
Change the parameter back to true
again since we want the dialog to be modal.