Article View: borland.public.jbuilder.java.swing
Article #10668Re: JMenuBar painting problem
From: Jim Stoll
Date: Wed, 18 Aug 1999 00:00
Date: Wed, 18 Aug 1999 00:00
38 lines
2332 bytes
2332 bytes
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've also tried show on everything that I could think of that woud possibly be in the path from the menubar to the frame, but the only result comes from calling show() on the JFrame itself. Someday I hope to figure out the whole Java/Swing painting thing and then I can die a satisfied man... :-) Is calling JFrame.show() an expensive operation? (I presume that it is...) The frame is already showing, so I don't know if a call to show() causes everything to be repainted or just changed items? I fear that if/when I have some heavy stuff in the JInternalFrames such as JTree, JTable, etc, the call to show() will be a serious drag on the GUI.. (Beyond that, it's just plain ugly to be calling show()...) Thanks for the help! Jim "Paul Furbacher [TeamB]" wrote: > 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? > > Just a guess, but have you called 'invalidate()' on either the menubar > or its parent? > > Paul Furbacher (TeamB)
Technical Details
Message-ID:
<37BAA3F7.C4E4D0B1@crtnet.com>Path:
arc1-ca.pugleaf.net!unknown!not-for-mailReferences:
<37B9940A.BB6B5F97@crtnet.com> <37B9DE36.91FDB14D@bilbo.bio.purdue.edu>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/18 Message-ID: <37BAA3F7.C4E4D0B1@crtnet.com> X-Deja-AN: 514183815 Content-Transfer-Encoding: 7bit References: <37B9940A.BB6B5F97@crtnet.com> <37B9DE36.91FDB14D@bilbo.bio.purdue.edu> 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