Examples: NotesAppletContext class

The following applet gets its Domino® context and prints the file name of the database containing it.

import lotus.domino.*;
public class platformApplet extends AppletBase
{
  java.awt.TextArea ta;
  public void notesAppletInit()
  {
    setLayout(null);
    setSize(100,100);
    ta = new java.awt.TextArea();
    ta.setBounds(0,0,98,98);
    add(ta);
    ta.setEditable(false);
    setVisible(true);
  }
  public void notesAppletStart()
  {
    Session s = null;
    try
    {
      s = this.openSession("Robert Test", "pw");
      if (s == null) //not able to make the connection, warn user
      {
        ta.append("Unable to create a session with the server");
        return;
      }
      NotesAppletContext ap = getContext(s);
      ta.append("Database = " + ap.getDatabase().getFileName());
    }
    catch(Exception e)
    {
      e.printStackTrace();
    }
    finally
    {
      try {this.closeSession(s);}
      catch(Exception e) {e.printStackTrace();}
    }
  }
}