Add 'src/jexer/' from commit 'cf01c92f5809a0732409e280fb0f32f27393618d'
[nikiroo-utils.git] / src / jexer / bits / Cell.java
index 4be433c7d33d8d05201fd6d3b869ff37e06cfa54..a8efa2b3c56465dc7ee93dc76fefa399bed85603 100644 (file)
@@ -73,7 +73,7 @@ public final class Cell extends CellAttributes {
     /**
      * The character at this cell.
      */
-    private char ch;
+    private int ch = ' ';
 
     /**
      * The display width of this cell.
@@ -94,7 +94,7 @@ public final class Cell extends CellAttributes {
      * The background color used for the area the image portion might not
      * cover.
      */
-    private Color background = null;
+    private Color background = Color.BLACK;
 
     /**
      * hashCode() needs to call image.hashCode(), which can get quite
@@ -119,7 +119,7 @@ public final class Cell extends CellAttributes {
      * @see #reset()
      */
     public Cell() {
-        reset();
+        // NOP
     }
 
     /**
@@ -129,8 +129,27 @@ public final class Cell extends CellAttributes {
      * @param ch character to set to
      * @see #reset()
      */
-    public Cell(final char ch) {
-        reset();
+    public Cell(final int ch) {
+        this.ch = ch;
+    }
+
+    /**
+     * Public constructor sets the attributes.
+     *
+     * @param attr attributes to use
+     */
+    public Cell(final CellAttributes attr) {
+        super(attr);
+    }
+
+    /**
+     * Public constructor sets the character and attributes.
+     *
+     * @param ch character to set to
+     * @param attr attributes to use
+     */
+    public Cell(final int ch, final CellAttributes attr) {
+        super(attr);
         this.ch = ch;
     }
 
@@ -244,7 +263,7 @@ public final class Cell extends CellAttributes {
      *
      * @return cell character
      */
-    public char getChar() {
+    public int getChar() {
         return ch;
     }
 
@@ -253,7 +272,7 @@ public final class Cell extends CellAttributes {
      *
      * @param ch new cell character
      */
-    public void setChar(final char ch) {
+    public void setChar(final int ch) {
         this.ch = ch;
     }