Java Reference
In-Depth Information
TABLE 12-2 Methods of the class Container
public Component add(Component comp)
//Appends the specified component to the end of this container.
public Component add(Component comp, int index)
//Adds the specified component to this container at the
//position specified by index.
public void paint(Graphics g)
//Paints the container with the graphics component specified by g.
public void update(Graphics g)
//Invokes the paint method.
public void validate()
//Validates this container and all of its subcomponents. The
//method validate is used to cause a container to lay out its
//subcomponents once more. Typically called after the components
//it contains have been added to or modified.
In the remainder of this chapter, whenever we list the methods of a class, we will not
show the methods that are inherited from the class es Component and Container .
Next, we discuss how to create a Java applet. For the most part, the programs in this
chapter are Java applets.
Applets
The term applet refers to a little application. In Java, an applet is a Java program that is
embedded within an HTML document and executed by a Web browser. You create an
applet by extending the class JApplet , which is contained in the package javax.swing .
Table 12-3 describes some commonly used methods of the class JApplet .
TABLE 12-3 Some Members of the class JApplet ( package javax.swing )
1
2
public void init()
//Called by the browser or applet viewer to inform this applet
//that it has been loaded into the system.
public void start()
//Called by the browser or applet viewer to inform this applet
//that it should start its execution. It is called after the init
//method and each time the applet is revisited in a Web page.
public void stop()
//Called by the browser or applet viewer to inform this applet
//that it should stop its execution. It is called before the
//method destroy.
 
 
Search WWH ::




Custom Search