If you have a question about how to reuse dialogs during the application life cycle, the best way is:
- define all contents of your dialog as subclasses of JPanel
- and instantiate a new JDialog with an existing instance of a subclass of JPanel
For point 2, you can, of course, use a lazy panel rating (create an instance the first time you use it, and then reuse it).
You will also need your panels to implement some interface (your own) that allows you to reinitialize them for reuse in the new JDialog (reinitializing usually means deleting the contents of all fields or changing these fields to their default values).
jfpoilpret
source share