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

How do you add an element to a set in java?

497


Is null or empty java?

535


What is finally and finalize in java?

595


What is keyword auto for?

643


What is the difference between replace and replace all?

477






What do you mean by chromounits in java8?

528


What does the “final” keyword mean in front of a variable? A method? A class?

548


Why does java have two ways to create child threads?

470


Is java still necessary?

622


How does class forname work in java?

483


Difference between keyword and identifier.

595


describe method overloading

540


What are different access specifiers in java? Explain

629


Java is pass by value or pass by reference? Explain

535


Is string is a class in java?

526