/** * Tests if this RtfColor is equal to another RtfColor. * * @param obj another RtfColor * @return <code>True</code> if red, green and blue values of the two colours match, <code>false * </code> otherwise. */ public boolean equals(Object obj) { if (!(obj instanceof RtfColor)) { return false; } RtfColor color = (RtfColor) obj; return (this.red == color.getRed() && this.green == color.getGreen() && this.blue == color.getBlue()); }
/** * Constructs a RtfColor as a clone of an existing RtfColor * * @param doc The RtfDocument this RtfColor belongs to * @param col The RtfColor to use as a base */ public RtfColor(RtfDocument doc, RtfColor col) { super(doc); if (col != null) { this.red = col.getRed(); this.green = col.getGreen(); this.blue = col.getBlue(); } if (this.document != null) { this.colorNumber = this.document.getDocumentHeader().getColorNumber(this); } }