When we invoke repaint() for a java.awt.Component object, the AWT invokes which of thefollowing method ?Optionsshow( )draw( )update( )none of these
Question
When we invoke repaint()
for a java.awt.Component
object, the AWT invokes which of the following method?
Options:
show()
draw()
update()
none of these
Solution
When repaint()
is invoked for a java.awt.Component
object, the AWT invokes the update(Graphics g)
method of that component. The update()
method is responsible for rendering the component's visuals, typically by calling the paint(Graphics g)
method, where the actual drawing happens.
Explanation:
show()
- This method is deprecated and is not used for painting.draw()
- This is not a method ofjava.awt.Component
.update(Graphics g)
- This method is called whenrepaint()
is invoked, whereg
is theGraphics
object to draw on.none of these
- Incorrect, asupdate()
is a valid method invoked during repainting.
Therefore, the correct answer is update().
Similar Questions
nswerWhen we invoke repaint() for a java.awt.Component object, the AWT invokes which of thefollowing method ?
Which is a Java call-back method invoked when a view is clicked of the following?a.Detectorb.None of thesec.OnClickDetectord.OnTapListener
Which method is used to set the visibility of a component in Java GUI?1 pointsetVisible()add()remove()setEnabled()
rrect answerWhich of these package is used for graphical user interface?Optionsjava.appletjava.awt.imagejava.awtjava.io
t answerWhich of those capabilities is referred to as to show the output of an applet?Optionsdisplay()displayApplet()paint()PrintApplet()
Upgrade your grade with Knowee
Get personalized homework help. Review tough concepts in more detail, or go deeper into your topic by exploring other relevant questions.