Win a copy of Java Concurrency Live Lessons this week in the Threads forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Menu Bar design issue.  RSS feed

 
Gregg Bolinger
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.
 
Aaron Roberts
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!