I have a class A ( which is a JFrame with card layout ). Two other classes B and C ( both are JPanels ). Class A initially displays an instance of the class B in its content pane. When a button is hit in the class B, I want to change the contents of the content pane of class A and display an instance of class C in the contentPane of class A. Please tell me how can we do this (handling the action event generated by the button in class B). One possibility is to make B and C inner class of Class A, so that they can access the cardlayout object of the class A to change the object it displays. Any other way of doing this?
Thanks.