Package jexer.bits

Class Cell


  • public class Cell
    extends CellAttributes
    This class represents a single text cell or bit of image on the screen.
    • Constructor Detail

      • Cell

        public Cell()
        Public constructor sets default values of the cell to blank.
        See Also:
        isBlank(), reset()
      • Cell

        public Cell​(int ch)
        Public constructor sets the character. Attributes are the same as default.
        Parameters:
        ch - character to set to
        See Also:
        reset()
      • Cell

        public Cell​(CellAttributes attr)
        Public constructor sets the attributes.
        Parameters:
        attr - attributes to use
      • Cell

        public Cell​(int ch,
                    CellAttributes attr)
        Public constructor sets the character and attributes.
        Parameters:
        ch - character to set to
        attr - attributes to use
      • Cell

        public Cell​(Cell cell)
        Public constructor creates a duplicate.
        Parameters:
        cell - the instance to copy
    • Method Detail

      • setImage

        public void setImage​(java.awt.image.BufferedImage image)
        Set the image data for this cell.
        Parameters:
        image - the image for this cell
      • getImage

        public java.awt.image.BufferedImage getImage()
        Get the image data for this cell.
        Returns:
        the image for this cell
      • getBackground

        public java.awt.Color getBackground()
        Get the bitmap image background color for this cell.
        Returns:
        the bitmap image background color
      • isImage

        public boolean isImage()
        If true, this cell has image data.
        Returns:
        true if this cell is an image rather than a character with attributes
      • restoreImage

        public void restoreImage()
        Restore the image in this cell to its normal version, if it has one.
      • isInvertedImage

        public boolean isInvertedImage()
        If true, this cell has image data, and that data is inverted.
        Returns:
        true if this cell is an image rather than a character with attributes, and the data is inverted
      • invertImage

        public void invertImage()
        Invert the image in this cell, if it has one.
      • getChar

        public int getChar()
        Getter for cell character.
        Returns:
        cell character
      • setChar

        public void setChar​(int ch)
        Setter for cell character.
        Parameters:
        ch - new cell character
      • getWidth

        public Cell.Width getWidth()
        Getter for cell width.
        Returns:
        Width.SINGLE, Width.LEFT, or Width.RIGHT
      • setWidth

        public void setWidth​(Cell.Width width)
        Setter for cell width.
        Parameters:
        width - new cell width, one of Width.SINGLE, Width.LEFT, or Width.RIGHT
      • reset

        public void reset()
        Reset this cell to a blank.
        Overrides:
        reset in class CellAttributes
      • unset

        public void unset()
        UNset this cell. It will not be equal to any other cell until it has been assigned attributes and a character.
      • isBlank

        public boolean isBlank()
        Check to see if this cell has default attributes: white foreground, black background, no bold/blink/reverse/underline/protect, and a character value of ' ' (space).
        Returns:
        true if this cell has default attributes.
      • equals

        public boolean equals​(java.lang.Object rhs)
        Comparison check. All fields must match to return true.
        Overrides:
        equals in class CellAttributes
        Parameters:
        rhs - another Cell instance
        Returns:
        true if all fields are equal
      • hashCode

        public int hashCode()
        Hashcode uses all fields in equals().
        Overrides:
        hashCode in class CellAttributes
        Returns:
        the hash
      • setTo

        public void setTo​(java.lang.Object rhs)
        Set my field values to that's field.
        Overrides:
        setTo in class CellAttributes
        Parameters:
        rhs - an instance of either Cell or CellAttributes
      • setAttr

        public void setAttr​(CellAttributes that)
        Set my field attr values to that's field.
        Parameters:
        that - a CellAttributes instance
      • toString

        public java.lang.String toString()
        Make human-readable description of this Cell.
        Overrides:
        toString in class CellAttributes
        Returns:
        displayable String
      • toHtml

        public java.lang.String toHtml()
        Convert this cell into an HTML entity inside a <font> tag.
        Overrides:
        toHtml in class CellAttributes
        Returns:
        the HTML string