So, I need to create a class that extends JDialog, to remove JDialog code from the main functions code.
However, I don’t know how to set it’s parent JFrame after the JDialog has been created.
It’s usually done by passing the JFrame to the constructor, but since it’s a custom class, I don’t know how to set it to be JDialogs parent. I couldn’t find any method of type JDialog.setParent(JFrame); I hope you understand the problem.
Any suggestions?
The parent
Window(FrameorDialog) is called owner in the APIs. You can only mention it in the constructor by calling the super class (JDialog) constructor.Example:
You cannot set it later, after your custom
JDialoghas been created.