🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

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

Re: Panel refresh problem

#13074
From: Richard Wilkman
Date: Fri, 02 Oct 1998 00:00
58 lines
2483 bytes
Frode:

The problem has existed in one form or another since pre-Beta Java. 
It's just much worse in JFC.

Here are some of the workarounds to try (no guarantees).

1.  repaint() -- call it.  heavy handed, but works most often.
2.  wiggle the container by changing it's size a couple pixels and
resetting it.  You may have to go a ways up the container chain to
find the right one.
3.  tickle it.  wiggle and then do the validate() dance
4.  lie to it. -- do an add and a remove of a very small component and
make doLayout fire.

-Rich

Frode Oldervoll wrote:
> 
> I have a JPanel (a)  that contains different other JPanels (b), one at a
> time, and I change the conent of panel a dynamically according to menu
> selections. My problem is that when I change the panels b the panel a won't
> redraw itself. I have tried various combinations of invalidate, validate,
> revalidate, etc., as in the code included below:
> 
>     a.removeAll();
>     b.setVisible(true);
>     a.add(b, "Center");
>     b.validate();
>     a.invalidate();
>     a.validate();
>     a.revalidate();
> 
> With all these validate-methods, the panel a still don't redraw itself with
> the correct content b. It works the first time I select a panel, but later I
> don't work.
> 
> What is the correct way to solve such a problem?
> 
> By the way, I use JDK 1.1.7 and Swing 1.0.3, but the problem is the same
> with JDK 1.1.6_Borland and Swing 1.0.1.
> 
> -Frode

-- 

=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
Rich Wilkman
Senior Quality Assurance Engineer
Borland JBuilder Team

If you see something that looks like an opinion up there,
it's mine and mine alone.

Mail sent to me from the newsgroups won't bounce but will
be ignored.  If I have time, I'll respond, but you  have
a better chance if you confine your posts to the newsgroups
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
Technical Details
Message-ID: <3614FADC.22809416@inprise.com>
Path: arc1-ca.pugleaf.net!unknown!not-for-mail
References: <6v24o7$3kh7@forums.borland.com>

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: 111d45,d70978371e769ca6
X-Google-Attributes: gid111d45,public
From: Richard Wilkman <rwilkman@inprise.com>
Subject: Re: Panel refresh problem
Date: 1998/10/02
Message-ID: <3614FADC.22809416@inprise.com>
X-Deja-AN: 397082185
Content-Transfer-Encoding: 7bit
References: <6v24o7$3kh7@forums.borland.com>
Content-Type: text/plain; charset=us-ascii
Organization: Another Netscape Collabra Server User
Mime-Version: 1.0
Newsgroups: borland.public.jbuilder.java.swing