Advertisement
Help Keep Boards Alive. Support us by going ad free today. See here: https://subscriptions.boards.ie/.
If we do not hit our goal we will be forced to close the site.

Current status: https://keepboardsalive.com/

Annual subs are best for most impact. If you are still undecided on going Ad Free - you can also donate using the Paypal Donate option. All contribution helps. Thank you.
https://www.boards.ie/group/1878-subscribers-forum

Private Group for paid up members of Boards.ie. Join the club.

JTextPane max amount of text

  • 24-07-2002 05:48PM
    #1
    Closed Accounts Posts: 536 ✭✭✭


    I'm looking to insert a string into a TextPane in Java.
    However if I insert too big a string then I get the following error:

    javax.swing.text.StateInvariantError: infinite loop in formatting
    ........................

    What I'm wondering is, is there any function that I can call to tell me what the maximum amount of text that the text pane can hold?

    I tried getmaximumsize() but that as far as I can see only tells me the max dimensions of the text pane itself.


Comments

  • Registered Users, Registered Users 2, Paid Member Posts: 2,032 ✭✭✭lynchie


    How much text are you trying to put into it?

    Also, are you using a JTextPane or a JTextArea?


  • Closed Accounts Posts: 536 ✭✭✭flyz


    Originally posted by lynchie
    How much text are you trying to put into it?

    Also, are you using a JTextPane or a JTextArea?

    As much as I can :)

    It's a log which will be continously add more and more text.
    At the moment I'm getting chunks of data of size 2000 bytes at a time from a database and I get the error if I've more than 6 entries in the database.

    I need to know a definate value of the size of the amount of text I can add as I will be deleting some of the older data once I exceed this limit.


    I'm using JTextPane too btw


  • Registered Users, Registered Users 2, Paid Member Posts: 2,032 ✭✭✭lynchie


    I've thrown together a quick app to test how much you can put into it. I have gotten as far as roughly 34000 (34K) bytes before it throws the exception. There does seem to be a limit on it and i've checked the Sun Forums and although several people have had this problem there doesnt seem to be a definite answer as to whether this is a bug or a limitation.


Advertisement