/** * Copyright (c): Uwe Schmidt, FH Wedel * * You may study, modify and distribute this source code * FOR NON-COMMERCIAL PURPOSES ONLY. * This copyright message has to remain unchanged. * * Note that this document is provided 'as is', * WITHOUT WARRANTY of any kind either expressed or implied. */ import java.awt.Color; import java.awt.Graphics; import javax.swing.JApplet; //-------------------- public class ParamTest extends JApplet { private String p1 = "???", p2 = "!!!", p3 = "the default for p3"; public void init() { p1 = getParam("dieAntwort", p1); p2 = getParam("dieFrage", p2); p3 = getParam("dieUnbekannte",p3); } String getParam(String p, String d) { String r = getParameter(p); return r == null ? d : r; } //-------------------- public void paint( Graphics g ) { setBackground(Color.pink); g.drawString("p1=" + p1 + ", p2=" + p2 + ", p3=" + p3, 25, 25); g.drawString("CodeBase:", 25, 45); g.drawString(getCodeBase().toString(), 25, 65); g.drawString("DocumentBase:", 25, 85); g.drawString(getDocumentBase().toString(), 25,105); showStatus("Applet painted"); } //-------------------- public String getAppletInfo() { return "ParamTest.java"; } //-------------------- public String [][] getParameterInfo() { String [][] info = { {"dieAntwort", "ein String", "eine Antwort"}, {"dieFrage" , "ein String", "eine Frage" } }; return info; } }