Post date: 2007-03-01 15:40Much 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();
}
}
}
|