🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

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

Re: Beginner : JB3 and JMenuBar

#10835
From: Tor Iver Wilhelmsen
Date: Mon, 09 Aug 1999 00:00
31 lines
1341 bytes
ptha0005_1_lsurf <pthazard@libertysurf.fr> writes:

> Hi,
> I have a class "Desktop" (extends JFrame) with in the jbInit() method :
>     JMenuBar mb = new JMenuBar();
>     JMenu menu = new JMenu("File");
>     setJMenuBar(mb);
>     mb.add(menu);
> It runs well on Win NT, but the menu is not visible in the JB3's
> interface builder (the frame is).

If the menu is only a _method_ variable, the designer will not see
it. To have the designer see it, create it as an instance variable:

JMenuBar mb = new JMenuBar();
JMenu menu = new JMenu("File");

// ...

void jbInit() {

  // ...
  mb.add(menu);
  this.setJMenuBar(mb);
  // ...
}

Also note: The "menu designer" is separate from the "frame" designer:
When you have the menu as an instance field, you should be able to
start its designer from the subnode of "Menu" node on the designer
tree.
Technical Details
Message-ID: <uiu6pxvku.fsf@sds.no>
Path: arc1-ca.pugleaf.net!unknown!not-for-mail
References: <37AC5DEE.DE4A25FB@libertysurf.fr>

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: 111d45,c3e79cc7c87af7
X-Google-Attributes: gid111d45,public
From: Tor Iver Wilhelmsen <tor.wilhelmsen@sds.no>
Subject: Re: Beginner : JB3 and JMenuBar
Date: 1999/08/09
Message-ID: <uiu6pxvku.fsf@sds.no>
X-Deja-AN: 510513018
Sender: towi@SDSA1761
References: <37AC5DEE.DE4A25FB@libertysurf.fr>
Organization: Another Netscape Collabra Server User
Newsgroups: borland.public.jbuilder.java.swing