Start networking and exchanging professional insights

Register now or log in to join your professional community.

Follow

Is it good or bad practice to use multiple JFrames?

user-image
Question added by Usama Saad , Senior Software Engineer (Java) , Saudi Catering Company
Date Posted: 2013/09/04
Usama Saad
by Usama Saad , Senior Software Engineer (Java) , Saudi Catering Company

I had found that answer: 

Bad practice.

·         User unfriendly: The user sees multiple icons in their task bar when expecting to see only one. Plus the side effects of the coding problems..

·         A nightmare to code and maintain:

1.     modal dialog offers the easy opportunity to focus attention on the content of that dialog - choose/fix/cancel this, then proceed. Multiple frames do not.

2.     A dialog (or floating tool-bar) with a parent will come to front when the parent is clicked on - you'd have to implement that in frames if that was the desired behavior.

 

There are many number of ways of displaying many elements in one GUI, e.g.:

·         CardLayout (short demo.). Good for:

1.    Showing wizard like dialogs.

2.    Displaying list, tree etc. selections for items that have an associated component.

3.    Flipping between no component and visible component.

·         JInternalFrame/JDesktopPane typically used for an MDI.

·         JTabbedPane for groups of components.

·         JSplitPane A way to display two components of which the importance between one or the other (the size) varies according to what the user is doing.

·         JLayeredPane far many well ..layered components.

·         JToolBar typically contains groups of actions or controls. Can be dragged around the GUI, or off it entirely according to user need. As mentioned above, will minimize/restore according to the parent doing so.

·         As items in a JList (simple example below).

·         As nodes in a JTree.

·         Nested layouts.

 

 

 

 

More Questions Like This

Do you need help in adding the right keywords to your CV? Let our CV writing experts help you.