Thanks to my previous post (
https://coderanch.com/t/666115/GUI/java/Creating-Java-Forms-Subforms), I was able to switch my sub-form from a JFrame to JDialog. My problem now, if I need to pass data from my
parent form to my sub-form. I think I figured it out, but I just want to make sure I'm going in the right direction.
In the above code I created an instance of my sub-form and then, pass the parent with the this reference and true to the modal variable, and also 10 as my data that I want to pass to my sub-form.
I modified the constructor of the sub-form. to accept the int and then set my JTextField with the value. When I modified the sub-form code the following also had to modified with -1 as the default.
It works, however, as I've learned over time,
just because it works doesn't mean it's the proper/correct way of doing it. Is the above correct for passing data to a sub-form?
Secondly, How would I in my sub-form properly close it. Right now I use:
in my sub-form. When the user clicks okay/accept, how would I properly close it? Do I
need to call dispose on my sub-form in my parent form after
the sub-form is closed?