Examples: NotesColor property (ColorObject - Java)

This agent writes to the NotesColor property based on user input from the agent comment, then displays all the color properties.

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();
    }
  }
}