dominoExperts.com - Powered by Domino 8.5.2 Domino Accelerator Pack
- GoFaster=1
Lotus Triple Search DominoExperts + Blogs + R8 forum
dominoExperts.com -> Script vault -> Java

 Swing in Lotus Notes agents


dicklarssonPost date: 2007-03-01 15:40

Much nicer interface!

First of all, be aware, creating graphical user interfaces is not the recommended.
But it is possible.

We ask the user for text that will be stored in a new document in the current database.

import lotus.domino.*;
import javax.swing.*;

public class JavaSwing extends AgentBase {
 // Author: Dick Larsson, dick.larsson@ekakan.com, +46(0)706-33 23 68
 public void NotesMain() {

  try {
   Session session = getSession();
   AgentContext agentContext = session.getAgentContext();
   Database db = agentContext.getCurrentDatabase();
   int answer = -1;
   String subject = null;
   while (answer != 0) {
    subject = JOptionPane.showInputDialog("Enter subject");
    answer = JOptionPane.showConfirmDialog(null, "Is this correct "
      + subject + " as subject?");
   }
   JOptionPane.showMessageDialog(null, "Thank you");

   Document doc = db.createDocument();
   doc.replaceItemValue("Subject", subject);
   doc.save(true, true);
   doc.recycle();
   db.recycle();

  } catch (Exception e) {
   e.printStackTrace();
  }
 }
}




RSS feed
Subscribe to Forum

Share this page

Top posters
Tomas Nielsen212
Joacim Boive27
Fredrik Stöckel27
Danne14
Niklas Waller13
Kenneth Haggman11
Bryan Kuhn10
Daniel Lehtihet9
Jonas Israelsson8
dm997