0
votes

What I am looking for is a way to navigate through different JPanels in just one JFrame. To navigate the user should use buttons located inside these panels.

I am no using any layouts. I want all my jpanels in the same position.when we submitting the corresponding button

I hope you guy's can help me out, i Have a menubar in my jframe and for each item different panels.

1
"I am no using any layouts." Java GUIs might have to work on a number of platforms, on different screen resolutions & using different PLAFs. As such they are not conducive to exact placement of components. To organize the components for a robust GUI, instead use layout managers, or combinations of them, along with layout padding & borders for white space. Further, I cannot see this question as being solved when using null layouts, so save yourself some time and learn how to use them now. - Andrew Thompson
thank you for your advice i will definitely try it - Lijo

1 Answers

5
votes

You will want to use a CardLayout, it was designed to allow you to switch the active panel from one panel to another.

Unless you intend never to run you program on any other PC other then the one it was created (and never update the OS or hardware), you will want to learn to make use of layout managers.

PC's come in all shapes and sizes, with differences between OS's (and versions of OS's), display drivers and screens which will all make your program look different on each system it is run on. Layout managers take out the guess work involved in trying to deal with these situations.