Is there a way for a component to access the component that contains it? For example, if there is a JPanel named firstPanel and I've added a secondJPanel Jpanel to firstJpanel, can secondJPanel call firstPanel with something like myContainer.setBackground?
Asked
Active
Viewed 23 times
0
-
2Just call `secondJPanel.getParent()` . – Arnaud Jun 05 '18 at 12:06
-
@Berger post that as an answer – jhamon Jun 05 '18 at 12:07
-
3@jhamon: it's a common duplicate – Hovercraft Full Of Eels Jun 05 '18 at 12:08