What is update method and when it is called?

Answer Posted / mayank

The update() method is defined by the AWT and is
called when your applet has requested that a
portion of its window be redrawn. The problem is
that the default version of update() first fills
an applet with the default background colour and
then calls paint(). You can override the update()
method. The paint() in this case will simply call
update().

public void update(Graphic g) {
//Redisplay your window here.
}

public void paint(Graphics g) {
update(g); // call to the update()method.
}

Is This Answer Correct ?    10 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is the output of the below java program?

824


Is it possible to compare various strings with the help of == operator? What are the risks involved?

851


what do you understand by synchronization? Or what is synchronization and why is it important? Or describe synchronization in respect to multithreading? Or what is synchronization? : Java thread

715


Using callable statement how can you pass out parameters, explain with example?

896


How does the java compiler work?

740


how we can create packages in java?

725


Can we define package statement after import statement in java?

784


What is the base class of all exception classes?

816


Why put method is idempotent?

664


Can we use a default constructor of a class even if an explicit constructor is defined?

849


What are runtime exceptions?

903


Can we convert stringbuilder to string in java?

764


Can you explain the cs option of java interpreter?

712


What is core java used for?

761


Discuss about garbage collector in Java.

865