Article View: borland.public.jbuilder.java.swing
Article #9172Re: JPanel refresh problem
From: rwilkman
Date: Tue, 09 May 2000 00:00
Date: Tue, 09 May 2000 00:00
83 lines
2969 bytes
2969 bytes
Aurelien:
Which one you use depends on the tasks, what you might be doing between
the invalidate() and the time it gets done, etc. Often it's good enough
to simply do all the work and call validate() at the end.
-Rich
Aurelien Broszniowski wrote:
>
> 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.
> > =====
--
=====
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:
<39183103.81692AC3@inprise.com>Path:
arc1-ca.pugleaf.net!unknown!not-for-mailReferences:
<3916C2E3.4C184D1B@sensiva.com> <391738B5.5EBFDB4D@bilbo.bio.purdue.edu> <3916CC3E.5B66D947@sensiva.com> <39174465.3B555951@inprise.com> <3916DC83.FA96BF5@sensiva.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: rwilkman <rwilkman@inprise.com> Subject: Re: JPanel refresh problem Date: 2000/05/09 Message-ID: <39183103.81692AC3@inprise.com> X-Deja-AN: 621159380 Content-Transfer-Encoding: 7bit References: <3916C2E3.4C184D1B@sensiva.com> <391738B5.5EBFDB4D@bilbo.bio.purdue.edu> <3916CC3E.5B66D947@sensiva.com> <39174465.3B555951@inprise.com> <3916DC83.FA96BF5@sensiva.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