🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

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

Re: JPanel refresh problem

#9170
From: Aurelien Broszniowski
Date: Mon, 08 May 2000 00:00
60 lines
2303 bytes
Ok I see! Thanks a lot.
invalidate() is to be called after or before ? and for add or remove ?

Should I do write like:

  jPanel1.invalidate();
  jPanel1.removeAll();
  jPanel1.add(new JLabel("Hello"));
  jPanel1.validate();

?
Because I tried this above, and it's nearly ok, but not totally. Indeed, it seems
to
refresh well about the jPanel1.add(...), but not about the jPanel1.removeAll()


rwilkman wrote:

> Aurelien:
>
> When you add or remove components from a container, you must call
> Container.invalidate() and/or Container.validate().  Resizing the
> container simply forces these calls.
>
> -Rich
>
> Aurelien Broszniowski wrote:
> >
> > Paul Furbacher wrote:
> >
> > > Aurelien Broszniowski wrote:
> > >
> > > > I've got a problem with a JPanel, when I want to update the contents, I
> > > > do:
> > > >
> > > >  jPanel1.removeAll();
> > > >  jPanel1.add(new JLabel("Hello"));
> > > >
> > > > But I need to resize the Frame by hand with my mouse before the JPanel
> > > > shows the updates!
> > >
> > > Have you called "jPanel1.invalidate()"?
> > >
> > > Paul Furbacher (TeamB)
> >
> > No, actually I really did a very simple application with a Frame into which
> > there's a JPanel where I want to add and remove components.
>
> --
> =====
> Rich Wilkman
> Senior Quality Assurance Engineer
> JBuilder Team
>
> If something in this post looks like an opinion, walks like an
> opinion and quacks like an opinion, it's mine and not that of
> my employer.
>
> If you are reading this from a newsgroup post, don't send mail.
> =====
Technical Details
Message-ID: <3916DC83.FA96BF5@sensiva.com>
Path: arc1-ca.pugleaf.net!unknown!not-for-mail
References: <3916C2E3.4C184D1B@sensiva.com> <391738B5.5EBFDB4D@bilbo.bio.purdue.edu> <3916CC3E.5B66D947@sensiva.com> <39174465.3B555951@inprise.com>

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: 111d45,f01bc2622e0cd022
X-Google-Attributes: gid111d45,public
From: Aurelien Broszniowski <aurelien@sensiva.com>
Subject: Re: JPanel refresh problem
Date: 2000/05/08
Message-ID: <3916DC83.FA96BF5@sensiva.com>
X-Deja-AN: 620877016
Content-Transfer-Encoding: 7bit
References: <3916C2E3.4C184D1B@sensiva.com> <391738B5.5EBFDB4D@bilbo.bio.purdue.edu> <3916CC3E.5B66D947@sensiva.com> <39174465.3B555951@inprise.com>
X-Accept-Language: en
Content-Type: text/plain; charset=us-ascii
Organization: Another Netscape Collabra Server User
Mime-Version: 1.0
Reply-To: aurelien@sensiva.com
Newsgroups: borland.public.jbuilder.java.swing