Hi guys, Basically I have a base JPanel class that extends JPanel, i.e 'public class basePanel extends JPanel' in this class I created a new panel and added some stuff to it.
Now inside another class, I wanted to add this basePanel to the center panel in my main class. So I instantiated the basePanel class (created an new instance of that class) and tried adding it to the centerPanel.
BasePanel bPanel = new BasePanel(); centerPanel.add(basePanel);
The thing is, when I run my app nothing appears in the center panel. I have tried removing the center panel before adding the base panel and then adding the center panel to the pane again but have had no luck. Any help would be much appreciated....
If a component has been added to a container that has been displayed, validate must be called on that container to display the new component. If multiple components are being added, you can improve efficiency by calling validate only once, after all the components have been added.