#3 multiple instances display the last text

open
nobody
None
5
2001-11-22
2001-11-22
Anonymous
No

JEditTextArea jta1 = new JEditTextArea();
jta1.setText("xxxxxx");

JEdittextArea jta2 = new JEditTextArea();
jta2.setText("yyyyyy");

This causes even jta1 to display "yyyyyy"

Looks like there is a static reference in
JEditTextArea that I am not able to figure out

Please help

Discussion

  • RoddyM

    RoddyM - 2002-02-18

    Logged In: YES
    user_id=323100

    Try
    jta2.setDocument(new SyntaxDocument());
    just after creating jta2.
    The default's for JEditText area are to share the same
    document amongst all instances.

     
  • Rob

    Rob - 2002-08-29

    Logged In: YES
    user_id=570959

    Yeah, that bummed me out for a while too, but setting a new
    instance of a document seemed to do the trick (plus I
    removed the word final from everywhere, but I think that was
    not needed)
    i.e.
    setDocument(new org.syntax.jedit.SyntaxDocument());

     
  • Nobody/Anonymous

    Logged In: NO

    I think this is a serious bug. Should be fixed soon!

     
  • Gregory Loribel

    Gregory Loribel - 2004-06-12

    Logged In: YES
    user_id=597335

    To use multiple instances with differents settings, you must
    use your own implementation of TextAreaDefaults, not
    DEFAULT.

     
  • Nobody/Anonymous

    Logged In: NO

    To avoid this issue, you have to assign a new TokenMarker to the second instance.

    jta2.setTokenMarker(new syntax.tokenmarker.TSQLTokenMarker());

     
  • Nobody/Anonymous

    Logged In: NO

    The instance of the TextAreaDefaults.document is shared between all JEditTextArea's - hence the document content is shared. The document must be newly instantiated for each instance of the editor.

     

Log in to post a comment.

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:





No, thanks