You are currently viewing our boards as a guest which gives you limited access to view most discussions and access our other features. By joining our free community, you will:
have access to post topics
communicate privately with other members (PM)
not see advertisements between posts
have the possibility to earn one of our surprises if you are an active member
access many other special features that will be introduced later.
Please any one tell me difference between paint/repaint/update, validate/revalidate/invalidate, doLayout/pack method of Component.
Also understanding updateUI!
paint is a container method which receives a graphics context and is used to render a container and all of its children
repaint is what we use in event code to ask a component to re-render itself
update: used in AWT drawing to avoid flicker; its use in Swing is not recommended/needed.
validate - container AWT method which we call when any changes have been made that might affect the layout of a container; asks the container to do a new layout of its children
revalidate - (a great) JComponent method with similiar affect to validate
invalidate - used to mark a component that needs to have its layout redone; occasionally used in AWT
doLayout - rarely used unless you are doing some lower-level layout research/work
pack is a top-level container method that will get everything layed out in the minimum space required and ready for display.
updateUI is used only when you need to change/update the look and feel
These methods are all explained in the javadocs.