- > I have a jframe defined in a package ‘abc’. this jframe acts as a main class too.
- > the same package ‘abc’ also contain 4 jpanels(panel1,panel2,panel3,panel4) defined in different java classes.
how one should call/show these different jpanels from main jframe class at user clicks on different buttons ?
what if I’ve got 40-50 such jpanels.what would be the most efficient way to toggle these panels from the main class ?
This is a very simple example that uses
next()and one button to change panels.An alternative (among many) would be to use 3 buttons where each one shows a specific panel (by using
showinstead ofnext).See this for more info.