🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

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

Re: JMenuBar painting problem

#10757
From: Jim Stoll
Date: Tue, 17 Aug 1999 00:00
30 lines
1672 bytes
I've found a nasty work-around for the problem - I call JFrame.show() after
a JMenu is added or removed to/from the JMenuBar.  I'm not particularly
happy w/ this 'big hammer' approach, however, and invite those with
alternative ideas on the solution to provide some suggestions!

BTW, there is no mixing of heavyweight/lightweight components going on here
- everything is from javax.swing...

Thanks,

Jim

Jim Stoll wrote:

> I'm adding/removing JMenus to a JMenuBar at runtime via the
> JMenuBar.add()/remove() methods.  The JMenus are being added and removed
> from the JMenuBar object, but are not being repainted appropriately -
> I'm ending up with 'holes' in my menu that remain there until I
> physically resize the JFrame that holds the JMenuBar - on resize of the
> frame, the proper paint operation occurs and things are updated.  I've
> tried calling paint, repaint, paintComponent, paintChildren, etc, but
> all to no avail.
>
> What can I do to ensure that the UI is visually updated when I
> add/remove items to/from the JMenuBar?
>
> Thanks!
>
> Jim Stoll
> jestoll@crtinc.com
Technical Details
Message-ID: <37B9DA88.B1AF09A9@crtnet.com>
Path: arc1-ca.pugleaf.net!unknown!not-for-mail
References: <37B9940A.BB6B5F97@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: Jim Stoll <jestoll@crtnet.com>
Subject: Re: JMenuBar painting problem
Date: 1999/08/17
Message-ID: <37B9DA88.B1AF09A9@crtnet.com>
X-Deja-AN: 513961721
Content-Transfer-Encoding: 7bit
References: <37B9940A.BB6B5F97@crtnet.com>
X-Accept-Language: en
Content-Type: text/plain; charset=us-ascii
Organization: Another Netscape Collabra Server User
Mime-Version: 1.0
Newsgroups: borland.public.jbuilder.java.swing