Consider the following applet program Public class stars ext

Consider the following applet program. Public class stars extends JApplet implements MouseListener {int x = 10, y = 10; public void paint (Graphics page) {addMouseListener(this); page.drawString(\"*\", x, y);} public void mouseClicked (MouseEvent event) {x = event.getPint().x; y = event.getPoint (), y; repaint();} ...} Which methods and in which order are called when the applet below is loaded in the browser (circle the correct answer)? paint, mouseCIicked paint mouseCIicked, paint Which methods and in which order are called when the mouse is clicked (circle the correct answer)? paint, mouseCIicked paint mouseCIicked, paint What must be added (replacing ...) so that the program compiles without errors (assuming that the requited java packages are imported)? A definition of the repaint() method Definition of the mousePressed, mouseReleased, mouseEntered, and mouseExited methods. A definition of the main() method

Solution

A)answer : b

explanation:- when the applet is loaded in web browser the paint method is called and executed , because it is base method for applet. mouseClicked will executed when mouse is clicked, after paint method..

B)answer: a

expalanation: intially paint method is called and executed to load applet in browser, after that, when mouse is clicked, mouseClicked will executed to perform action..

C)answer: a

explanation: in the given program, every method has its definitions except repaint() method, so, to compile program with out any errors, we must provide, definition of repaint method

 Consider the following applet program. Public class stars extends JApplet implements MouseListener {int x = 10, y = 10; public void paint (Graphics page) {addM

Get Help Now

Submit a Take Down Notice

Tutor
Tutor: Dr Jack
Most rated tutor on our site