I have created an application that has a toolbar, menubar and content area. I have added the menu and toolbar to the application window, but I am stuck with displaying the panel in content area based on the button action (like add, display) which is clicked through the toolbar. Is this a right way to do this? Is there any better way to do this?
Share
If I understand correctly, you want to have multiple
JPanels, only one of which is shown at a time? If that’s the case, it sounds like aCardLayoutis what you need. You basically add all yourJPanelsto it with unique names, and then you can tell theCardLayoutwhich of them to show.