<html><head><meta name="color-scheme" content="light dark"></head><body><pre style="word-wrap: break-word; white-space: pre-wrap;">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 &lt; temp.length(); i++) 
    {
         character = temp.charAt(i);
         if (character == '\n') count = count + 1;
    }

    return count;
}
</pre></body></html>