Article View: borland.public.jbuilder.java.swing
Article #10669Re: JMenuBar painting problem
From: Paul Furbacher [TeamB]
Date: Wed, 18 Aug 1999 00:00
Date: Wed, 18 Aug 1999 00:00
30 lines
1633 bytes
1633 bytes
Jim Stoll wrote:
> I've tried both invalidate() and revalidate() on the menu bar, content pane,
> root pane and the JFrame itself, but all with no discernable effect. [...]
I did to test whether invalidate() works to overcome what
appear to be your problem. It does work in conjunction
with repaint(...), but maybe I wasn't doing exactly what
you have been trying to do.
I put a JMenuBar with File, Edit and Help menus in it into a JFrame.
In the File menu, I added an Open and a Close menu item.
I dropped a button on the frame and in its actionPerformed
handler, I wrote:
menuBar.remove(editMenu);
fileMenu.remove(openMenuItem);
menuBar.invalidate();
menuBar.repaint(100);
That worked: the Edit menu disappeared and the Help menu
moved to the left. Upon popping down the File menu, only
Close appeared.
Remove the invalidate() and it appears as if the Edit menu
were still in the menuBar component.
Paul Furbacher (TeamB)
Technical Details
Message-ID:
<37BAC7E8.4213E34D@bilbo.bio.purdue.edu>Path:
arc1-ca.pugleaf.net!unknown!not-for-mailReferences:
<37B9940A.BB6B5F97@crtnet.com> <37B9DE36.91FDB14D@bilbo.bio.purdue.edu> <37BAA3F7.C4E4D0B1@crtnet.com>Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 111d45,9687ead9ed7fb42d X-Google-Attributes: gid111d45,public From: "Paul Furbacher [TeamB]" <pf@bilbo.bio.purdue.edu> Subject: Re: JMenuBar painting problem Date: 1999/08/18 Message-ID: <37BAC7E8.4213E34D@bilbo.bio.purdue.edu> X-Deja-AN: 514226680 Content-Transfer-Encoding: 7bit References: <37B9940A.BB6B5F97@crtnet.com> <37B9DE36.91FDB14D@bilbo.bio.purdue.edu> <37BAA3F7.C4E4D0B1@crtnet.com> Content-Type: text/plain; charset=us-ascii Organization: Reverse Alchemy, Inc. Mime-Version: 1.0 Reply-To: pf@bilbo.bio.purdue.edu Newsgroups: borland.public.jbuilder.java.swing