Example #1
0
 public Phrase(String s, int x, int y, Color c, WebLEAPFrame g) {
   x1 = x;
   y1 = y;
   color = c;
   gui = g;
   canvas = gui.getVisualizer();
   font = new Font("Dialog", 0, 14);
   fmetrics = canvas.getFontMetrics(font);
   text = s;
 }
  public void init() {
    repaint();
    //		String figname=this.getParameter("fig");
    NetworkReader nr = new NetworkReader();
    //        String baseDir=nr.getBaseDir(this.getCodeBase().getPath(),"/");
    //        String baseDir=nr.getBaseDir(this.getCodeBase().toString(),"/");
    String baseDir = this.getParameter("baseDir");
    if (baseDir == null) {
      baseDir = nr.getBaseDir(this.getCodeBase().getPath(), "/");
    }
    String codeDir = (this.getCodeBase()).toString();
    CommunicationNode cn = new CommunicationNode();
    cn.setIsApplet(true);
    cn.setCodeDirForApplet(codeDir);
    cn.setBaseDirForApplet(baseDir);
    Locale locale = new Locale("", "");
    /*
    System.out.println("country="+locale.getCountry());
    System.out.println("locale="+locale.toString());
    System.out.println("language="+locale.getLanguage());
    */
    cn.resourceBundle = ResourceBundle.getBundle("dsrWords", locale);
    cn.setTitle("DSR/communication node - teacher");
    cn.className = "Communication_Node";
    cn.setWords();
    cn.setIcons(cn.getIconPlace());
    cn.setControlMode("local");
    //		cn.spawnApplication("WebLEAPFrame");

    WebLEAPFrame wf = new WebLEAPFrame();
    Settings st = new Settings();
    st.setIsApplet(true);
    st.setBaseUrl(baseDir);
    st.initTab();
    wf.setSettings(st);
    UrlTable ut = new UrlTable("url list", cn);
    wf.setUrlTable(ut);
    DrawFrame df = new DrawFrame();
    df.setIsApplet(true);
    df.editdispatch.setSeparator("/");
    System.out.println("codeBase=" + codeDir);
    System.out.println("baseDir=" + baseDir);
    //		df.setIcons(baseDir+"images/");
    df.setIcons(cn.getIconPlace());
    df.clearAll();
    df.textEditFrame.setIcons(baseDir + "images/");
    //		df.show();
    df.setVisible(true);
    wf.setDraw(df);
    //		wf.setIcons(baseDir+"images/");
    wf.setIcons(cn.getIconPlace());
    wf.clearAll();
    wf.setVisible(true);
    this.changeMessage();
  }