Gui - Best way to navigate between windows?

I am trying to create gui (Swing) for a simple java application. The application should have an initial window similar to the menu. From there, I would like to go to a few other windows.

My question is is it best practice to achieve such navigation? Should I create several JFrames and switch their visibility on / off when navigating OR, if I better have one JFrame and add / remove JPanels in this single frame in order to move between windows?

Thanks.

+3
source share
4 answers

If each of your windows corresponds to a different task (possibly nested), you can present your application as SDI, and on the left - the taskbar , eg:

demo

In each task, one JFrame will be displayed with a corresponding window.

Another solution: content table as shown on the left

(note: in fact, this example also displays the taskbar in the lower right corner)

SwingXDemo

+1
source

I recommend

  • Do not run the MDI application with subframes similar to those found in the old days of Windows. They suck when they make this question get confused.
  • Create a tabbed interface. The welcome / menu page will be displayed on the first tab, which is always created at the beginning.

All the cool kids do it these days:

  • Visual studio
  • Eclipse
  • Firefox
+2
source

Several JFrames sound like the best idea for me. Much more OO.

+1
source

You must find a balance between these goals:

  • Not too many things in one "window"
  • The user must quickly find the desired window to perform the next step.
  • All necessary information should be visible at any time.

Eclipse solves this by creating many small editors, where each editor displays specific information and allows it to be modified. Then the editors are placed in one OS window on tabs and "views". The view is always fully visible and they can be arranged. Think about how to crop an existing editor in half (horizontal or vertical), and then replace one of the halves with another editor. Between each half you have a splitter so you can adjust the sizes.

Then, the layout of the views is stored in perspectives.

This allows each user to create a perspective that contains all the necessary editors at the same time, organize them as necessary and work efficiently.

+1
source

All Articles