Solved

Work-around for 4500 word textarea limit

Posted on 1997-06-23
4
227 Views
Last Modified: 2011-10-03
I'm bumping into a 4,500 word/29,395 character limit in my java textarea.  Is there a work-around that would allow me to put more stuff in my java text-areas .. ie. a web-page of material totaling 60,000 + characters?

Thanks so much!
0
Comment
Question by:askrinsky
  • 2
  • 2
4 Comments
 
LVL 6

Accepted Solution

by:
jpk041897 earned 100 total points
ID: 1222011
Back in the days of CPM (I know, ancient history :-) ) Wordstar came up with a Word proccesos that could run on 8K give you a (for then) amazing 40K work space. What was even more amazing, was that you could process a file that was over 360K long! (Well, that was a lot back then).

The way that WS did it should also work well for you.

As long as the text fits in memry, Create 2 Strings, One will contain the total text and the other one will contain a window into the text.

Maintain an int pointer that will allow you to call substring, to extract text from the main text string and store it in the window text (by window, I mean a window int the large text buffer, not an actual window).

Display the contents of the String window on to your textArea. (If you are going to do heavy edditing on the text, set up the window string to contain arround 2/3 of the available space).

Subclass the scroll bars and the appendText()/insertText() methods so that you know when you have reaches the top/bootom of the string window and can store/read another section of the main text. And count the number of characters appended/inserted. When you are close to the textArea limit, append/insert the changed text into the main text buffer.

Its a lot of work but not particularly difficult.

removing text can be handled by obtaining the length() of the window String at the time you load and store a text window. If the values are diferent, or a flag is set by the append/insert methods, you know you will have to replace the section of the main text buffer that was mapped on the text window with the text contained in the window .

Hope this answers your question.
0
 

Author Comment

by:askrinsky
ID: 1222012
(Edited by Computer101) that looks like a pain.  But thanks for your keen insights.

Why the limit anyway?  What's your read?

Thank you so much,

Anthony
0
 

Author Comment

by:askrinsky
ID: 1222013
Does the limit apply in JavaScript too?  I think it does unfortunately... what to do then?
0
 
LVL 6

Expert Comment

by:jpk041897
ID: 1222014
>Why the limit anyway? What's your read?

The limits existance is not Java's fault, but the undering plattforms. (Windows to be precise).

Remember that allmost all of the AWT is handled by peer classes, which translates to native calls. When MS designed Windows (back in the days of Win 2.0) they figured that an upper limit of 32K was more then enough for an edit window. In those days memory models only allowed you 64K total for the data section of your program.

Of course, MS never figured on the future growth of hardware (no news here). Unfortunatley, MS's solution to the problem was the Rich Text edit control, which is not portable to other platforms.

Sun was therfore forced to choose between not porting for Windows or limmiting textField size for all plattforms. The market sort of forced a desition there.

>Does the limit apply in JavaScript too? I think it does unfortunately... what to do then?

Yes it does.

You can use Live Connect and let the applet handle the buffering for you
0

Featured Post

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
servlet requestdispatcher include and forward differences 1 39
web services creation SOAP vs REST 5 56
xampp tool 12 56
Unhandled exception type Exception 18 42
Introduction Java can be integrated with native programs using an interface called JNI(Java Native Interface). Native programs are programs which can directly run on the processor. JNI is simply a naming and calling convention so that the JVM (Java…
Java functions are among the best things for programmers to work with as Java sites can be very easy to read and prepare. Java especially simplifies many processes in the coding industry as it helps integrate many forms of technology and different d…
Viewers learn about the “while” loop and how to utilize it correctly in Java. Additionally, viewers begin exploring how to include conditional statements within a while loop and avoid an endless loop. Define While Loop: Basic Example: Explanatio…
Viewers will learn how to properly install Eclipse with the necessary JDK, and will take a look at an introductory Java program. Download Eclipse installation zip file: Extract files from zip file: Download and install JDK 8: Open Eclipse and …

856 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question