package com.touchgraph.wikibrowser; import java.awt.Color; import java.security.AccessControlException; import javax.swing.*; public class TGWikiBrowserApplet extends JApplet { TGWikiPanel wikiPanel; public void init() { this.getContentPane().add("Center", new JLabel("Loading ...")); /* read the tag's parameters */ TGWikiBrowser.WIKI_FILE = getParameter("DATA_URL"); TGWikiBrowser.WIKI_URL = getParameter("WIKI_URL"); TGWikiBrowser.INITIAL_NODE = getParameter("INITIAL_NODE"); TGWikiBrowser.INITIAL_RADIUS = Integer.parseInt(getParameter("LOCALITY_RADIUS")); TGWikiBrowser.INITIAL_SHOW_BACKLINKS = new Boolean(getParameter("SHOW_BACKLINKS")).booleanValue(); // TODO: Some eyecandy while this loads ... try { wikiPanel = new TGWikiPanel(getAppletContext()); wikiPanel.setBorder(BorderFactory.createLineBorder(Color.black)); this.getContentPane().add("Center", wikiPanel); } catch (AccessControlException ace) { //custom title, error icon this.getContentPane().add(new JLabel (ace.getMessage() + "\nThis applet can load Wiki topologies only from the originating host")); } /* This was copied from TGWikiBrowser.buildPanel()'s FindAction: */ public void setTopic(String topic) { if ( ! topic.trim().equals("")) { getAppletContext().showStatus("Looking for " + topic + " ..."); WikiNode foundNode = (WikiNode) wikiPanel.getTGPanel().findNodeLabelContaining(topic); if (foundNode!=null) { wikiPanel.setLocale(foundNode); wikiPanel.tgPanel.setSelect(foundNode); wikiPanel.setWikiTextPane(foundNode); } else { JOptionPane.showMessageDialog(this, "Topic " + topic + " was not found."); } getAppletContext().showStatus(""); } } }