 public int getLineCount()
 {
    char               character;
    int                count, i;
    String             temp;

    temp = this.getText();

    count = 1;   // Initialize the line counter
    
	if (temp.length() == 0) // No words means no lines
		count = 0; 

    // 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;
}
