Win a copy of Escape Velocity: Better Metrics for Agile Teams this week in the Agile and Other Processes forum!
  • 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
  • Liutauras Vilda
  • Tim Cooke
  • Paul Clapham
  • Jeanne Boyarsky
Sheriffs:
  • Ron McLeod
  • Frank Carver
  • Junilu Lacar
Saloon Keepers:
  • Stephan van Hulst
  • Tim Moores
  • Tim Holloway
  • Al Hobbs
  • Carey Brown
Bartenders:
  • Piet Souris
  • Frits Walraven
  • fred rosenberger

JMenuItems

 
Ranch Hand
Posts: 194
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hello guys,

I am implementing my GUI and am putting together my menu bar. I have a quick question about JMenuItems:

I have created a JPopupMenu and want to add JMenuItem objects from the main menu bar onto this popup menu. The problem is when I add these menu items to the popup menu, they are removed from the main menu bar.

Is it only possible to have a menu item attached to one menu? Also is there are way to clone a menu item so I can add it to both?

I think that having to create two identical menu items that do the exact same thing is a waiste of time and resouce just because a menu item can only be attached to one menu at a time.

Does anyone else implement a popup menu with the same menu items that are available in the main menu for convenience to the user? Do you create two identical object to accoplish this or is there a way to have a menu item attached to two menus at the same time?

Thanx for any help.

James.
 
Ranch Hand
Posts: 329
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I don't think so. I have created popup as well as menu item. In fact you should create a common class and use that for any user interface. If we do that way same code will not repeat in two or three user interface and give us more mark on OO design and GUI same time.
 
Do you pee on your compost? Does this tiny ad?
the value of filler advertising in 2021
https://coderanch.com/t/730886/filler-advertising
reply
    Bookmark Topic Watch Topic
  • New Topic