CSCI111, Lab3 Achim Karger 2/10/2008 Description of the Java API Applet, Graphics and Color classes and some example methods: Applet: An applet is a small program that is intended not to be run on its own, but rather to be embedded inside another application. The Applet class must be the superclass of any applet that is to be embedded in a Web page or viewed by the Java Applet Viewer. The Applet class provides a standard interface between applets and their environment. Two examples for Applet methods: public void init() - Called by the browser or applet viewer to inform this applet that it has been loaded into the system. It is always called before the first time that the start method is called. A subclass of Applet should override this method if it has initialization to perform. public void showStatus(String msg) - Requests that the argument string be displayed in the "status window". Many browsers and applet viewers provide such a window, where the application can inform users of its current state. Color: The Color class is used to encapsulate colors in the default sRGB color space or colors in arbitrary color spaces identified by a ColorSpace. A Color constructor: Color(int r, int g, int b) - Creates an opaque sRGB color with the specified red, green, and blue values in the range (0 - 255). A Color method: equals(Object obj) - Determines whether another object is equal to this Color. Graphics: The Graphics class is the abstract base class for all graphics contexts that allow an application to draw onto components that are realized on various devices, as well as onto off-screen images. Two example for Graphics methods: drawLine(int x1, int y1, int x2, int y2) - Draws a line, using the current color, between the points (x1, y1) and (x2, y2) in this graphics context's coordinate system. setFont(Font font) -Sets this graphics context's font to the specified font.