/* * File: MoreHelloApplet.java * * Yet another Hello World applet * * Copyright: Northeast Parallel Architectures Center * */ import java.applet.Applet; import java.awt.Font; import java.awt.Graphics; import java.awt.Color; public class MoreHelloApplet extends Applet { Font f = new Font( "SansSerif", Font.BOLD, 36 ); public String name; public void init() { // Get the "Name" parameter from the HTML document: name = getParameter( "Name" ); if ( name == null ) name = "World"; } public void paint( Graphics g ) { g.setFont( f ); g.setColor( Color.red ); // Concatenate strings with + operator: String str = "Hello " + name + "!"; g.drawString( str, 5, 50 ); } }