Java Reference
In-Depth Information
EXAMPLE 12-3
//GrandWelcome Applet
import java.awt.*;
import javax.swing.JApplet;
public class GrandWelcome extends JApplet
{
public void paint(Graphics g)
{
super .paint(g);
g.setColor(Color.red);
g.setFont( new Font("Courier", Font.BOLD, 24));
g.drawString("Welcome to Java Programming", 30, 30);
}
}
The HTML file for this program contains the following code:
<HTML>
<HEAD>
<TITLE>WELCOME</TITLE>
</HEAD>
<BODY>
<OBJECT code = "GrandWelcome.class" width = "440"
height = "50">
</OBJECT>
</BODY>
</HTML>
Sample Run: Figure 12-5 shows the output of the GrandWelcome applet.
1
2
FIGURE 12-5 Output of the GrandWelcome applet
 
Search WWH ::




Custom Search