How can I easily provide default values for when applet parameters are not specified?

John Zukowski

Here's a helper method that you can use to do that:

import java.applet.*;

public class AppletUtils {
  private AppletUtils() {}

  public static String getParameter(
      Applet applet, String key, String keyDefault) {

    String value = applet.getParameter(key);

    return (value == null) ? keyDefault : value;

Here's how to call:
  String var = AppletUtils.getParameter(this, "name", "Jaeger");