Re: Changing JFrame components at runtime



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
.



Relevant Pages

  • Re: Labels not displaying properly...help!?
    ... revalidate() or invalidate() and validate ... > private String currentTemp; ... > repaint(); ...
    (comp.lang.java.programmer)
  • Re: Pat Metheny PM 120 or PM 100..looking to buy
    ... They will validate or invalidate your opinions on may things, ... If only that you're more creaky. ...
    (rec.music.makers.guitar.jazz)
  • Re: Pat Metheny PM 120 or PM 100..looking to buy
    ... They will validate or invalidate your opinions on may things, ... Iconoclasm kills rock. ...
    (rec.music.makers.guitar.jazz)
  • Re: Custom Component wont fit in a JScrollPane
    ... | "Walter Probst" wrote in message ... but try invalidate(); and validate; ... "newsfan" wrote in message ...
    (comp.lang.java.gui)
  • Re: DBC Corruption
    ... Your problem is atypical - you can, in fact, routinely perform such edits. ... FoxPro I've tried both of the suggested fixes (validate and rebuild the ... RECOVER it will delete the offending tables from the container, ... I'll also mention that the database container contains a local view, ...
    (microsoft.public.fox.vfp.dbc)