• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • paul wheaton
  • Paul Clapham
  • Ron McLeod
Sheriffs:
  • Jeanne Boyarsky
  • Liutauras Vilda
Saloon Keepers:
  • Tim Holloway
  • Carey Brown
  • Roland Mueller
  • Piet Souris
Bartenders:

FBN: Design Help Required for GUI

 
Ranch Hand
Posts: 80
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
From last week i am working on GUI part of my assignment. Comments by Mark on MVC pattern https://coderanch.com/t/181301/java-developer-SCJD/certification/implement-MVC was very helpful.
I have question on Menu :
I have seperated classes for each menu option in menubar like FBNFileMenu,
FBNSearchMenu, FBNBookMenu, and FBNHelpMenu. All these menu class extends JMenu. Each Menu class hold indiviual menu items(whole-part relation ship);
along with actionlistener and enable disable methods.
I have seperate FBNMenu class which extends JMenuBar; this wraps all menu classes(like FBNFileMenu, FBNSearchMenu..etc). This FBNMenu class will
be used in GUI as menu component. Idea here is extension and resusabiilty(OCP priciple). Is it write design pattern(Adapter pattern) for menu? or is there any other design pattern for menu ?
Sample code:



I am considering to have only two menu one file menu (open, close and exit as menu item) and other help menu(docmentation and about). I do not want have seperate menu for search and book, since there is only one menu item is there, these (search and book)options are shown on two seperate panels. is it ok ?
Should i have seperate classes for search and book panels or utility class with two method(for search) one to create panel with two items in row (label and combobox) and other(for booking) with label and textfield in row ? Is it good GUI design have seperate class for each GUI Component; for
Menu, Search Panel, Book Panel and Table Panel to put inside GUI ?
Thanks,
Akash
 
author and jackaroo
Posts: 12200
280
Mac IntelliJ IDE Firefox Browser Oracle C++ Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Akash,

I am considering to have only two menu one file menu (open, close and exit as menu item) and other help menu(docmentation and about). I do not want have seperate menu for search and book, since there is only one menu item is there, these (search and book)options are shown on two seperate panels. is it ok ?


This is very similar to the menus I used. So yes, I think it is OK.
Regarding your other questions: why don't you try and list the good and bad points for your options? No doubt others here will add their points as well. Then you can choose what you would like to do, and you will already have your thoughts laid out for your design document
Regards, Andrew
 
Akash Singh
Ranch Hand
Posts: 80
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks Andrew.
Advantage of having seperate classes for FileMenu and other is resuablility, if any other screen needs same menu options.
Having utility class to create panels of two items in row is again related to reusablity , if any other screen needs same kinds of panels.
What is the typical design pattern for setting up menu in screen? Has any one used mediator , command pattern in FBN GUI ?
 
Andrew Monkhouse
author and jackaroo
Posts: 12200
280
Mac IntelliJ IDE Firefox Browser Oracle C++ Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Akash,
These are good advantages.
Possible disadvantage: more classes (objects).
I used the Command & Chain Of Responsibility patterns for my menu / tool bar / actions. Since I also used Heirachial Model View Controller, they all fitted together nicely.
I suspect, from code I have seen, most people do not go to this level of complexity though - they just have everything in one big class.
Regards, Andrew
 
reply
    Bookmark Topic Watch Topic
  • New Topic