I did a test with a simple JDialog and got the same results
So where is your test code (the SSCCE)? How many times do you have to be asked?
Where are the import statements? What is the point of the JOptionPane? How is it related to the problem? There is no main() method. There is no code to create and show your dialog. Yes, it is simple to add but but you have already done this because you created a test so why should we waste time trying to duplicated something that has already been done?. You want some help, so don't make use do extra work.
I'm finished with this posting. Good luck. Maybe next time you will post a proper SSCCE.