Explain the methods that control a Applet's on-screen appearance, update and paint.

Explain the methods that control a Applet's on-screen appearance, update and paint.

To refresh a page in an applet window without flashing, the update() method is to be overridden. It clears the background of the component, before invoking paint().

paint(): Every applet must implement the paint() method. A Graphics object is passed to the paint() method. drawstring() is the method used to write the contents on the applet’s window. The other methods of Graphics class are setColor(),drawRect(),setBackground() etc. All these methods are to be implemented in the paint() method.

Methods to control applet's appearance, update and paint
- The Applet class inherits a paint method from its parent Container class.
- The paint method is called when the applet is loaded, scrolled, etc.
- The update method is called in response to repaint and calls paint in turn.
Explain how Java interacts with database.
Java interacts with database using an API called Java Database Connectivity. JDBC is used to connect to the database...
How can we handle SQL exception in Java?
SQL Exception is associated with a failure of a SQL statement. This exception can be handled like an ordinary exception in a catch block...
What is DatabaseMetaData in Java?
DatabaseMetaData provides comprehensive information about the database...
Post your comment