This week's book giveaway is in the Agile and Other Processes forum.
We're giving away four copies of The Journey To Enterprise Agility and have Daryl Kulak & Hong Li on-line!
See this thread for details.
Win a copy of The Journey To Enterprise Agility this week in the Agile and Other Processes forum! And see the welcome thread for 20% off.
  • 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 all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Jeanne Boyarsky
  • Liutauras Vilda
  • Campbell Ritchie
  • Tim Cooke
  • Bear Bibeault
Sheriffs:
  • Paul Clapham
  • Junilu Lacar
  • Knute Snortum
Saloon Keepers:
  • Ron McLeod
  • Ganesh Patekar
  • Tim Moores
  • Pete Letkeman
  • Stephan van Hulst
Bartenders:
  • Carey Brown
  • Tim Holloway
  • Joe Ess

Menu Bar design issue.  RSS feed

 
Ranch Hand
Posts: 15304
6
Chrome IntelliJ IDE Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have been building Menu Bars for my Swing apps since I started with SWING several years ago.
While playing around with some different ideas on how to seperate and really modularize an app I am playing around with I had a thought and was wondering if anyone else would consider this a good idea or waste time or whatever.
I have a class called MainMenu which subclasses JMenuBar and basically consists of all my menu items for the main menu of the app.
What I thought about doing was go a step further and create a seperate class for each JMenu. So instead of having

fileMenu would actually be a seperate custom class of my own where I would add all the JMenuItems to it.
The reason I thought about doing this is a custom JMenuBar class can become quite large after adding a lot of JMenu's and JMenuItem's to it. But by subclassing JMenu, I have a file for each single Menu and can easily access and update that as neccessary rather than searching through an even larger file.
Of course the other thing is, other than what I mentioned above, is there really any other point to doing this.
So I would like to know if anyone else has done this, considered doing this, and generally what is thought of the above approach.
 
Ranch Hand
Posts: 174
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I would think a class such as that would be useful. If you added a few methods such as -
addMainMenuItem(string name)
addSubMenuItem(string name, string parentItem)
getMenuItem(string name)
It would probably speed up menu development for simple menus.
[ October 28, 2003: Message edited by: Aaron Roberts ]
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!