Re: Changing JFrame components at runtime
- From: Babu Kalakrishnan <bkk.ngroup@xxxxxxxxx>
- Date: Tue, 26 Sep 2006 03:29:59 +0530
lego_lax wrote:
Don't forget to call validate() after a remove/add.
The GUI is updated both using validate() or updateUI(). Which is
difference?
The updateUI() call is normally needed only if you're changing the UI
delegates of components - for example, if you switch Look and Feels at
run time.
A validate() call rarely helps when used by itself. (It performs a
validation only if swing thinks that the container's layout is in an
invalid state). You need to first call invalidate() followed by a
validate() for forcing a validation.
For Swing components, the best method to use after you've changed the
contents of a container is the revalidate() call (followed by a
repaint() ). However this method is not available in AWT
containers, so you'd have to use an invalidate() / validate() sequence
there.
BK
.
- References:
- Changing JFrame components at runtime
- From: lego_lax
- Re: Changing JFrame components at runtime
- From: Andrew Thompson
- Re: Changing JFrame components at runtime
- From: lego_lax
- Re: Changing JFrame components at runtime
- From: Andrew Thompson
- Re: Changing JFrame components at runtime
- From: lego_lax
- Re: Changing JFrame components at runtime
- From: Andrew Thompson
- Re: Changing JFrame components at runtime
- From: lego_lax
- Changing JFrame components at runtime
- Prev by Date: Re: GridBagLayout problems
- Next by Date: Re: GridBagLayout problems
- Previous by thread: Re: Changing JFrame components at runtime
- Next by thread: Re: Changing JFrame components at runtime
- Index(es):
Relevant Pages
|
|