File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Developer Certification (SCJD/OCMJD) and the fly likes FBN: Design Help Required for GUI Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Certification » Developer Certification (SCJD/OCMJD)
Bookmark "FBN: Design Help Required for GUI " Watch "FBN: Design Help Required for GUI " New topic
Author

FBN: Design Help Required for GUI

Akash Singh
Ranch Hand

Joined: Aug 21, 2003
Posts: 80
From last week i am working on GUI part of my assignment. Comments by Mark on MVC pattern http://www.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
Andrew Monkhouse
author and jackaroo
Marshal Commander

Joined: Mar 28, 2003
Posts: 11503
    
  95

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


The Sun Certified Java Developer Exam with J2SE 5: paper version from Amazon, PDF from Apress, Online reference: Books 24x7 Personal blog
Akash Singh
Ranch Hand

Joined: Aug 21, 2003
Posts: 80
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
Marshal Commander

Joined: Mar 28, 2003
Posts: 11503
    
  95

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
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: FBN: Design Help Required for GUI