users
[Top] [All Lists]

Re: [cinjug-users] Swing text components

To: Trey Howard <trey.howard@xxxxxxxxxxxx>
Subject: Re: [cinjug-users] Swing text components
From: James Hurt <JimHurt@xxxxxxxx>
Date: Fri, 21 Oct 2005 18:02:38 -0400
Cc: users@xxxxxxxxxx
Delivered-to: mailing list users@cinjug.org
In-reply-to: <43593D88.1060705@digilore.com>
Mailing-list: contact users-help@cinjug.org; run by ezmlm
References: <43593D88.1060705@digilore.com>
User-agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.7.2) Gecko/20040804 Netscape/7.2 (ax)
Trey Howard wrote:

I've noticed that if I paste large amounts of text (100k+ characters)
into a JTextArea that the JVM's performance takes a significant hit.
Has anyone else encountered this and is there is any workaround/solution?

I have also encountered this loss of performance. I believe that the cause is that the JTextArea tries to convert the entire text string to a bit map for rapid scrolling.


Needless to say, the memory required for the bit map is much larger than the memory required for the string itself. As the length of the string gets very long, your computer begins to run out of memory, your virtual memory system begins to thrash, and performance goes south.

No known workaround nor solution. Long term, what we need is a new class, sub-classed to JTextArea, that converts only the portion of text that is being displayed to a bit map. But this class will not provide the smooth scrolling of JTextArea.

Jim Hurt


<Prev in Thread] Current Thread [Next in Thread>