例: NotesColor property (ColorObject - Java™)

このエージェントは、エージェントのコメントからのユーザー入力に基づいて NotesColor プロパティに書き込みを行い、次に色のプロパティをすべて表示します。

import lotus.domino.*;

public class JavaAgent extends AgentBase {

  public void NotesMain() {

    try {
      Session session = getSession();
      AgentContext agentContext = session.getAgentContext();

      // (Your code goes here) 
      String ncStr = agentContext.getCurrentAgent().getComment();
      Integer nc = new Integer(ncStr);
      if (nc.intValue() >= 0 & nc.intValue() <= 240)
      {
        ColorObject color = session.createColorObject();
        color.setNotesColor(nc.intValue());
        System.out.println("Domino color = " + color.getNotesColor());
        System.out.println("RGB = " +
        color.getRed() + ", " + color.getGreen() + ", " +
        color.getBlue());
        System.out.println("HSL = " +
        color.getHue() + ", " + color.getSaturation() + ", " + 
        color.getLuminance());
      }
      else
        System.out.println(
        "Color number must be in range 0-240");

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