Set visibility of parent Container
I have been searching the documentation. What I am trying to do is change the visibility of the parent (JPanel) in this case, on button click. I tried getting the container and then casting to a JComponent but that didn't work. How do I get a hold of the current instance of the parent?
Thanks
Re: Set visibility of parent Container
Moved from New to Java.
To get better help sooner, post a SSCCE (Short, Self Contained, Compilable and Executable) example that demonstrates the problem.
db
Re: Set visibility of parent Container
Casting should work if the button's parent is actually a JPanel. But you don't need to cast it at all to change its visibility. JButton.getParent() returns a Container, and Container extends Component, which means it has the setVisible(...) method.