1 /* Yet another Hello World applet */ 2 3 import java.applet.Applet; 4 import java.awt.*; 5 6 public class MoreHelloApplet extends Applet { 7 8 Font f = new Font( "TimesRoman", Font.BOLD, 36 ); 9 public String name; 10 11 public void init() { 12 // Get the "Name" parameter from the HTML document: 13 name = getParameter( "Name" ); 14 if ( name == null ) name = "World"; 15 } 16 17 public void paint( Graphics g ) { 18 g.setFont( f ); 19 g.setColor( Color.red ); 20 // Concatenate strings with + operator: 21 String str = "Hello " + name + "!"; 22 g.drawString( str, 5, 50 ); 23 } 24 25 }