0

I'm pretty new to programming Java based GUI applications. Here's what I have in mind, I want to divide the window into two areas. The first are contains buttons (or a list), and based on which button was clicked, or which item was selected, the second area changes. (finite number of buttons) Something like this:

enter image description here

I can think of many ways to do this, but I am not sure what is the best practice. Do I have several invisible panels and make only 1 panel visible at a time, or do I change the ordering (bring panel x to front), or is there some other way?

Appreciate any help I receive!! Thanks in advance!

mKorbel
  • 109,525
  • 20
  • 134
  • 319
Nikhil
  • 99
  • 3
  • 10

1 Answers1

4

Although this is a primarily opinion-based answer I'd go with a Nested Layout approach:

Note: Buttons in the left panel should switch right panels cards.

See Lesson: Layoing Out Components within a Container tutorial.


For complex GUIs you have also third-party layout managers available, listed in this answer:

Community
  • 1
  • 1
dic19
  • 17,821
  • 6
  • 40
  • 69
  • 1
    Additionaly you may want to use [JSplitPane](http://docs.oracle.com/javase/tutorial/uiswing/components/splitpane.html) to place left and right panels. – dic19 Mar 16 '14 at 16:04