Examples: setRGB method

This form action uses the "Red," "Green," and "Blue" fields on a form as parameters to setRGB, and writes the resulting property values to the "NotesColor," "Red," "Green," "Blue," "Hue," "Saturation," and "Luminance" fields.

import lotus.domino.*;

public class JavaAgent extends AgentBase {

  public void NotesMain() {

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

      // (Your code goes here) 
      ColorObject color = session.createColorObject();
      DocumentCollection dc = agentContext.getUnprocessedDocuments();
      Document doc = dc.getFirstDocument();
      while (doc != null)
      {
        int r = doc.getItemValueInteger("Red");
        int g = doc.getItemValueInteger("Green");
        int b = doc.getItemValueInteger("Blue");
        color.setRGB(r, g, b);
        Integer i = new Integer(color.getNotesColor());
        doc.replaceItemValue("NotesColor", i);
        i = new Integer(color.getRed());
        doc.replaceItemValue("Red", i);
        i = new Integer(color.getGreen());
        doc.replaceItemValue("Green", i);
        i = new Integer(color.getBlue());
        doc.replaceItemValue("Blue", i);
        i = new Integer(color.getHue());
        doc.replaceItemValue("Hue", i);
        i = new Integer(color.getSaturation());
        doc.replaceItemValue("Saturation", i);
        i = new Integer(color.getLuminance());
        doc.replaceItemValue("Luminance", i);
        doc.save(true, true);
        doc = dc.getNextDocument(doc);  
      }

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