It looks like you are on the right track. The main thing your missing is that you need to display the dialog:
As you are learning Java, you should become familiar with the API documentation for the version you are using. These docs provide information about all the classes and methods that are available from the standard API. For example, if you look at the docs for JDialog, you will quickly see some links for a tutorial about how to use a dialog box. If you scroll further down, you will see the methods provided by the JDialog class. In this particular case, your MyDialog class inherits all of these methods, including show() which will display the dialog. I'll leave it to you to figure out how to hide the dialog when you are done with it.