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 memory leak and how does java handle it?

517


Where is stringbuffer stored?

547


What is set string?

592


How would you convert bytes to string?

560


What happens if we override only equals?

580






What is meant by vector class, dictionary class, hash table class, and property class?

675


How many times finalize method will be invoked? Who invokes finalize() method in java?

572


Why is String immutable?

616


What is a static method in java?

535


What is static import?

593


When do we use hashset over treeset?

529


What do you mean by checked exceptions?

531


What mechanism does java use for memory management?

488


What is outofmemoryerror in java?

561


How do you make an arraylist empty in java?

473