/** * ForumLauncher.java 1.00 12.18.96 Michael Shoffner * * Copyright (c) 1996 Prominence Dot Com, Inc. All Rights Reserved. * * Permission to use, copy, modify, and distribute this software * for non-commercial purposes and without fee is hereby granted * provided that this copyright notice appears in all copies. * * http://prominence.com/ shoffner@prominence.com */ import java.awt.*; import java.applet.*; import java.util.*; public class ForumLauncher extends Applet { Image icon; Frame client; String title; Color forumBgcolor; Vector send; public void init () { String bgcolor = getParameter ("bgcolor"); if (bgcolor != null) { try { setBackground (new Color(Integer.parseInt(bgcolor.substring(1), 16))); } catch (NumberFormatException ex) { System.out.println ("Invalid format for bgcolor:" + bgcolor); } } icon = getImage(getDocumentBase(),getParameter("icon","images/forum.gif")); // send parameters to Forum Frame send = new Vector(); send.addElement (this); send.addElement (getParameter ("title", "Sample Forum")); String fc = getParameter ("forumbgcolor"); if (fc != null) { try { forumBgcolor = new Color (Integer.parseInt (fc.substring(1), 16)); } catch (NumberFormatException ex) { System.out.println ("Invalid format for forumbgcolor:" + bgcolor); } } send.addElement (forumBgcolor); String welcome = getParameter ("welcome"); if (welcome != null) send.addElement (welcome); } public void paint (Graphics g) { int x = icon.getWidth (this); int y = icon.getHeight (this); g.drawImage (icon, (size().width - x)/2, (size().height - y )/2, this); } public String getParameter (String param, String def) { String result = getParameter (param); if (result != null) return result; else return def; } public boolean mouseDown (Event e, int x, int y) { if (client == null) { showStatus("Loading Forum..."); try { client = (Frame) Class.forName("Forum").newInstance(); } catch (ClassNotFoundException ex) { System.out.println(ex); } catch (InstantiationException ex) { System.out.println(ex); } catch (IllegalAccessException ex) { System.out.println(ex); } client.postEvent (new Event (client, -1, send)); } client.show(); return super.mouseDown (e, x, y); } }