I did not know that naming conventions affected compilation.
This is not true. The conditions are met to ensure consistency, readability and maintainability. The person who writes the code is not always the person who maintains the code. Therefore, if you want other people to read your code, especially when asking for help, follow the standards.
You can start with the Java Style Guide
I manually copy the code from another screen in accordance with the standards of my companies.
This is a complete waste of time. There is nothing patented in your code. Again, when you ask a question, the code must be in SSCCE form so that it demonstrates the problem. This allows you to delete all unnecessary codes.
It would be correct to determine the import.
This is exactly how you should do it. You want us to help you, so why waste time on this? Make it as easy as people want to help you.
Adding imports did not help. The code you posted is not compiling yet, so I donβt know if it accurately reflects the problem you are trying to describe.
Again, the code sending point is that we can copy / paste / compile / test. Until you publish the correct SSCCE, I will not respond.
Edit:
From my testing, if the visibility of a child window changes with the visibility of the parent when the parent becomes invisible, then the visibility of the child also changes with the parent when it becomes visible. Thus, it looks like the parent keeps the state of the child windows when visibility changes.
Thus, the solution should make the child window invisible to the parent:
showParentButton.setText(!showParentButton.isSelected() ? "SHOW": "HIDE"); aChild.setVisible(false); // add this aParent.setVisible(!showParentButton.isSelected());
If you don't have a link to the child window, I think you can use the Windows.getOwnedWindows() method to access all the child windows.
Other editing:
As a hack, I created my own dialog box, which cannot be displayed again after its placement:
final JDialog aChild = new JDialog(aParent) { private boolean disposed = false; @Override public void dispose() { super.dispose(); disposed = true; } @Override public void show() { if (disposed) return; super.show(); } };