+ private Color backColor = Color.BLACK;
+
+ /**
+ * Foreground color as 24-bit RGB value. Negative value means not set.
+ */
+ private int foreColorRGB = -1;
+
+ /**
+ * Background color as 24-bit RGB value. Negative value means not set.
+ */
+ private int backColorRGB = -1;
+
+ // ------------------------------------------------------------------------
+ // Constructors -----------------------------------------------------------
+ // ------------------------------------------------------------------------
+
+ /**
+ * Public constructor sets default values of the cell to white-on-black,
+ * no bold/blink/reverse/underline/protect.
+ *
+ * @see #reset()
+ */
+ public CellAttributes() {
+ // NOP
+ }
+
+ /**
+ * Public constructor makes a copy from another instance.
+ *
+ * @param that another CellAttributes instance
+ * @see #reset()
+ */
+ public CellAttributes(final CellAttributes that) {
+ setTo(that);
+ }
+
+ // ------------------------------------------------------------------------
+ // CellAttributes ---------------------------------------------------------
+ // ------------------------------------------------------------------------
+
+ /**
+ * Getter for bold.
+ *
+ * @return bold value
+ */
+ public final boolean isBold() {
+ return ((flags & BOLD) == 0 ? false : true);
+ }
+
+ /**
+ * Setter for bold.
+ *
+ * @param bold new bold value
+ */
+ public final void setBold(final boolean bold) {
+ if (bold) {
+ flags |= BOLD;
+ } else {
+ flags &= ~BOLD;
+ }
+ }
+
+ /**
+ * Getter for blink.
+ *
+ * @return blink value
+ */
+ public final boolean isBlink() {
+ return ((flags & BLINK) == 0 ? false : true);
+ }
+
+ /**
+ * Setter for blink.
+ *
+ * @param blink new blink value
+ */
+ public final void setBlink(final boolean blink) {
+ if (blink) {
+ flags |= BLINK;
+ } else {
+ flags &= ~BLINK;
+ }
+ }
+
+ /**
+ * Getter for reverse.
+ *
+ * @return reverse value
+ */
+ public final boolean isReverse() {
+ return ((flags & REVERSE) == 0 ? false : true);
+ }
+
+ /**
+ * Setter for reverse.
+ *
+ * @param reverse new reverse value
+ */
+ public final void setReverse(final boolean reverse) {
+ if (reverse) {
+ flags |= REVERSE;
+ } else {
+ flags &= ~REVERSE;
+ }
+ }
+
+ /**
+ * Getter for underline.
+ *
+ * @return underline value
+ */
+ public final boolean isUnderline() {
+ return ((flags & UNDERLINE) == 0 ? false : true);
+ }
+
+ /**
+ * Setter for underline.
+ *
+ * @param underline new underline value
+ */
+ public final void setUnderline(final boolean underline) {
+ if (underline) {
+ flags |= UNDERLINE;
+ } else {
+ flags &= ~UNDERLINE;
+ }
+ }
+
+ /**
+ * Getter for protect.
+ *
+ * @return protect value
+ */
+ public final boolean isProtect() {
+ return ((flags & PROTECT) == 0 ? false : true);
+ }
+
+ /**
+ * Setter for protect.
+ *
+ * @param protect new protect value
+ */
+ public final void setProtect(final boolean protect) {
+ if (protect) {
+ flags |= PROTECT;
+ } else {
+ flags &= ~PROTECT;
+ }
+ }
+
+ /**
+ * Getter for foreColor.
+ *
+ * @return foreColor value
+ */
+ public final Color getForeColor() {
+ return foreColor;
+ }