Results 1 to 2 of 2
  1. #1
    Join Date
    Aug 2007
    Posts
    45
    Rep Power
    0

    Default repaint validate doLayout

    Please any one tell me difference between paint/repaint/update, validate/revalidate/invalidate, doLayout/pack method of Component.
    Also understanding updateUI!

  2. #2
    hardwired's Avatar
    hardwired is offline Senior Member
    Join Date
    Jul 2007
    Posts
    1,576
    Rep Power
    9

    Default

    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.

Similar Threads

  1. Problem in repaint
    By Preethi in forum AWT / Swing
    Replies: 16
    Last Post: 03-18-2008, 08:10 PM
  2. Repaint problem
    By swimberl in forum Java 2D
    Replies: 1
    Last Post: 02-16-2008, 09:12 PM
  3. Repaint problem
    By swimberl in forum Java 2D
    Replies: 0
    Last Post: 01-06-2008, 03:28 AM
  4. Repaint fails when using threads
    By rjevans2000 in forum Threads and Synchronization
    Replies: 1
    Last Post: 09-21-2007, 11:22 PM
  5. Repaint fails when using threads
    By rjevans2000 in forum AWT / Swing
    Replies: 3
    Last Post: 08-15-2007, 05:42 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •