Chapter 6 Methods 299 The applet s init

Chapter 6 Methods 299 The applet s init method is called once by the applet container when an applet is loaded for execution. It performs initialization of an applet. The applet s start method is called after the init method completes execution and every time the user of the browser returns to the HTML page on which the applet resides (after browsing another HTML page). The applet s paint method is called after the init method completes execution and the start method has started executing to draw on the applet. It is also called every time the applet needs to be repainted. The applet s stop method is called when the applet should suspend execution normally, when the user of the browser leaves the HTML page on which the applet resides. The applet s destroymethod is called when the applet is being removed from memory normally, when the user of the browser exits the browsing session. Method repaint can be called in an applet to cause a fresh call to paint. Method repaint invokes another method called update and passes it the Graphics object. The update method invokes the paint method and passes it the Graphics object. TERMINOLOGY ActionEvent class Math class methods ActionListener interface Math.E actionPerformed method Math.PI argument in a method call Math.random method automatic duration method automatic variable method call base case in recursion method-call operator, () block method declaration block scope method definition call a method method overloading called method mixed-type expression caller modular program calling method named constant class overloading class scope paintmethod of JApplet coercion of arguments parameter in a method definition constant variable programmer-defined method copy of a value promotion rules destroy method of JApplet random-number generation divide and conquer read-only variable duration recursion element of chance recursion step factorial method recursive call final recursive method FlowLayout class reference parameter init method of JApplet reference types invoke a method repaint method of JApplet iteration return Java API (Java class library) return-value type JButton class of package javax.swing scaling JLabel class of package javax.swing scope JTextField class of package javax.swing setLayoutmethod of JApplet local variable shifting Copyright 1992 2002 by Deitel & Associates, Inc. All Rights Reserved. 7/3/01

Leave a Reply