🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: borland.public.jbuilder.java.swing
Article #11469

Re: So how do I add the same JMenu to two different JMenuBar's?

#11469
From: kerbel
Date: Mon, 24 May 1999 00:00
33 lines
1703 bytes
For individual menu items you would definitely use actions and simply
add the same action to as many menus/toolbars as you wish, however,
for a complete menu this wouldn't work. What I suggest is that you
have a method such as createMyMenu() and just have
menubar1.add(createMyMenu()) and menubar2.add(createMyMenu())

This way you are reusing the same menu.

Good luck...

Uri Kerbel
--
uri@kalbi.demon.co.uk
www.kalbi.demon.co.uk (Free Java applets and utilities)

On Thu, 20 May 1999 20:49:32 -0500, "Bob Byron"
<forums.inprise.com@radit.com> wrote:

>I tried adding a menu1 (an instance of JMenu) to menuBar1 (an instance of
>JMenuBar), then I added menu1 to menuBar2 (another instance of JMenuBar).
>Unfortunately, that seemed to remove it from menuBar1.  Is there a way I can
>easily clone menu1, or in some other way add it to both JMenuBar's?  I want
>the instance to reside on both and perform the same functionality from both.
>Why on earth would it remove itself from menuBar1?
>
>Thanks,
>Bob Byron
>RAD Systems, Inc.
>
>
>

--
Technical Details
Message-ID: <37490855.3050718@news.demon.co.uk>
Path: arc1-ca.pugleaf.net!unknown!not-for-mail
References: <7i2dtb$i384@forums.borland.com>

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: 111d45,26e9f6e11c3f0b
X-Google-Attributes: gid111d45,public
From: kerbel@kalbi.demon.co.uk
Subject: Re: So how do I add the same JMenu to two different JMenuBar's?
Date: 1999/05/24
Message-ID: <37490855.3050718@news.demon.co.uk>
X-Deja-AN: 481431775
X-NNTP-Posting-Host: kalbi.demon.co.uk:158.152.128.133
References: <7i2dtb$i384@forums.borland.com>
X-Trace: news.demon.co.uk 927533266 nnrp-03:28294 NO-IDENT kalbi.demon.co.uk:158.152.128.133
Reply-To: kerbel@kalbi.demon.co.uk
Newsgroups: borland.public.jbuilder.java.swing
X-Complaints-To: abuse@demon.net