tags:

views:

744

answers:

4

Hi,

I try to build a gui (Swing) for a simple java application. The application should have a start window like a menu. From there I would like to navigate to several other windows.

My question is what is the best-practice to achieve such a navigation? Should I build several JFrames and switch the visibility of them on/off when navigating OR should I better have one JFrame and add/remove JPanels in this single frame to navigate between the windows?

Thanks.

+2  A: 

I recommend

  • Do not do a MDI application with sub-frames like those found in the old Windows days. They suck as they make the matter confusing.
  • Do design a tabbed interface. The welcome page/menu will be displayed on a first tab that is always created on the start.

All cool kids do that nowadays:

  • Visual Studio
  • Eclipse
  • Firefox
Johannes Schaub - litb
A: 

Multiple JFrames sounds like a better idea to me. Much more OO.

cagcowboy
+1  A: 
VonC
+1  A: 

You must find a balance between these goals:

  • Not too many things in one "window"
  • The user must quickly be able to find the correct window to do the next step of work
  • All relevant information must be visible at any time

Eclipse solves this by creating many small editors where each editor shows some specific information and allows to modify it. Editors are then arranged within one OS window in tabs and "views". A view is always completely visible and they can be arranged. Think of a view as a way to cut an existing editor in half (horizontal or vertical) and then being able to replace one of the halves with another editor. Between each half, you have a splitter so you can adjust the sizes.

Arrangements of views are then saved in "perspectives".

This allows every user to create a perspective which contains all the necessary editors at the same time, arrange them as they need it and work effectively.

Aaron Digulla