public int getLineCount()
{
    char               character;
    int                count, i;
    String             temp;

    temp = this.getText();

    // Initialize the line counter
    count = 1;
    if (temp.length() == 0) count = 0; // No words means no lines

    // Count the number of newline characters
    for (i=0; i < temp.length(); i++) 
    {
         character = temp.charAt(i);
         if (character == '\n') count = count + 1;
    }

    return count;
}
