ابدأ بالتواصل مع الأشخاص وتبادل معارفك المهنية

أنشئ حسابًا أو سجّل الدخول للانضمام إلى مجتمعك المهني.

متابعة

Is it good or bad practice to use multiple JFrames?

user-image
تم إضافة السؤال من قبل Usama Saad , Senior Software Engineer (Java) , Saudi Catering Company
تاريخ النشر: 2013/09/04
Usama Saad
من قبل 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.

 

 

 

 

المزيد من الأسئلة المماثلة